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

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    overflow-x: hidden;
}

.game-container {
    width: 100%;
    max-width: 960px;
    padding: 20px;
}

/* 头部 */
.header {
    text-align: center;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 2.6em;
    margin-bottom: 15px;
    text-shadow: 0 0 25px rgba(255, 71, 87, 0.6);
    letter-spacing: 2px;
}

.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 12px 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    gap: 12px;
}

.player-hud {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.05em;
}

.player-hud.p1 .hud-label { color: #00ff96; }
.player-hud.p2 .hud-label { color: #ff4757; }

.hud-label {
    font-weight: bold;
    min-width: 54px;
}

.hearts {
    letter-spacing: 2px;
}

.score {
    color: #ffd700;
    font-weight: 600;
}

.mode-badge {
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

/* 菜单 */
.menu {
    text-align: center;
    padding: 40px 20px;
}

.menu h2 {
    font-size: 1.9em;
    margin-bottom: 35px;
    color: #ffd700;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-width: 460px;
    margin: 0 auto 35px;
}

.mode-btn {
    padding: 28px 32px;
    border: 2px solid transparent;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    backdrop-filter: blur(10px);
}

.mode-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.35);
}

.mode-btn.vs-ai {
    border-color: #00ff96;
}

.mode-btn.vs-ai:hover {
    background: rgba(0, 255, 150, 0.12);
    box-shadow: 0 14px 35px rgba(0, 255, 150, 0.2);
}

.mode-btn.vs-player {
    border-color: #ff4757;
}

.mode-btn.vs-player:hover {
    background: rgba(255, 71, 87, 0.12);
    box-shadow: 0 14px 35px rgba(255, 71, 87, 0.2);
}

.mode-title {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 8px;
}

.mode-desc {
    font-size: 0.95em;
    opacity: 0.8;
}

.controls-info {
    margin-top: 25px;
    padding: 22px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    font-size: 0.95em;
    line-height: 2;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.controls-info p {
    opacity: 0.85;
}

/* 游戏区域 */
.game-area {
    display: flex;
    justify-content: center;
    position: relative;
}

#gameCanvas {
    border: 3px solid rgba(255, 215, 0, 0.5);
    border-radius: 10px;
    background: #0b0b1a;
    box-shadow: 0 0 50px rgba(255, 71, 87, 0.15);
    max-width: 100%;
    height: auto;
}

.screen-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    pointer-events: none;
    background: radial-gradient(circle, rgba(255, 0, 0, 0.35) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.15s ease-out;
}

.screen-flash.active {
    opacity: 1;
}

/* 结算 */
.game-result {
    text-align: center;
    padding: 55px 25px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 18px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-result h2 {
    font-size: 2.6em;
    margin-bottom: 18px;
}

.game-result.win h2 { color: #00ff96; }
.game-result.lose h2 { color: #ff4757; }
.game-result.draw h2 { color: #ffd700; }

.game-result p {
    font-size: 1.2em;
    margin-bottom: 28px;
    opacity: 0.9;
}

.restart-btn {
    padding: 15px 55px;
    font-size: 1.15em;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, #ffd700, #ff9500);
    color: #1a1a2e;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.35);
}

/* 暂停 */
.pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(6px);
}

.pause-box {
    text-align: center;
}

.pause-title {
    font-size: 3.2em;
    margin-bottom: 15px;
    color: #ffd700;
}

.pause-overlay p {
    font-size: 1.2em;
    opacity: 0.8;
}

/* 响应式 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }

    .hud {
        justify-content: center;
    }

    .mode-title {
        font-size: 1.25em;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 12px;
    }

    .header h1 {
        font-size: 1.7em;
    }

    .menu h2 {
        font-size: 1.5em;
    }

    .mode-btn {
        padding: 22px 20px;
    }

    .pause-title {
        font-size: 2.2em;
    }
}
