/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

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

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

h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    background: linear-gradient(45deg, #ffeb3b, #ff9800);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 700px;
    margin: 0 auto;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    backdrop-filter: blur(5px);
    flex-wrap: wrap;
    gap: 10px;
}

.current-player {
    font-size: 1.2rem;
}

#current-player {
    font-weight: bold;
    color: #ffeb3b;
}

.game-mode button {
    padding: 8px 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.game-mode button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.theme-selector {
    display: flex;
    align-items: center;
    gap: 5px;
}

.theme-selector label {
    font-size: 1rem;
}

.theme-selector select {
    padding: 5px 10px;
    border-radius: 5px;
    border: none;
    background-color: rgba(255, 255, 255, 0.8);
    color: #333;
    font-size: 0.9rem;
    cursor: pointer;
}

/* 音频控制 */
.audio-controls {
    display: flex;
    gap: 10px;
}

#sound-toggle, #music-toggle {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

#sound-toggle:hover, #music-toggle:hover {
    background-color: #45a049;
}

#sound-toggle.muted, #music-toggle.muted {
    background-color: #f44336;
}

#sound-toggle.muted:hover, #music-toggle.muted:hover {
    background-color: #d32f2f;
}

/* 主题样式 */
body.classic-theme {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c);
}

body.neon-theme {
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
}

body.neon-theme #board {
    background-color: #1a1a2e;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

body.neon-theme .black {
    background: radial-gradient(circle at 30% 30%, #ff00ff, #7700ff);
    box-shadow: 0 0 10px #ff00ff;
}

body.neon-theme .white {
    background: radial-gradient(circle at 30% 30%, #00ffff, #0099cc);
    box-shadow: 0 0 10px #00ffff;
}

body.nature-theme {
    background: linear-gradient(135deg, #134e5e, #71b280, #134e5e);
}

body.nature-theme #board {
    background-color: #8fbc8f;
    box-shadow: 0 5px 15px rgba(0, 50, 0, 0.5);
}

body.nature-theme .black {
    background: radial-gradient(circle at 30% 30%, #3e2723, #1a0e0a);
    border: 1px solid #3e2723;
}

body.nature-theme .white {
    background: radial-gradient(circle at 30% 30%, #f5f5dc, #d2b48c);
    border: 1px solid #d2b48c;
}

body.space-theme {
    background: linear-gradient(135deg, #000428, #004e92, #000428);
}

body.space-theme #board {
    background-color: #0a0a0a;
    box-shadow: 0 0 20px rgba(100, 100, 255, 0.3);
}

body.space-theme .black {
    background: radial-gradient(circle at 30% 30%, #333, #000);
    border: 1px solid #000;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

body.space-theme .white {
    background: radial-gradient(circle at 30% 30%, #ddd, #999);
    border: 1px solid #999;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

body.cyberpunk-theme {
    background: linear-gradient(135deg, #ff00ff, #00ffff, #ff00ff);
}

body.cyberpunk-theme #board {
    background-color: #1a0033;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
}

body.cyberpunk-theme .black {
    background: radial-gradient(circle at 30% 30%, #ff00ff, #990099);
    border: 1px solid #ff00ff;
    box-shadow: 0 0 10px #ff00ff;
}

body.cyberpunk-theme .white {
    background: radial-gradient(circle at 30% 30%, #00ffff, #009999);
    border: 1px solid #00ffff;
    box-shadow: 0 0 10px #00ffff;
}

/* 游戏区域 */
main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-container {
    width: 100%;
    max-width: 700px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* 棋盘样式 */
.board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#board {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1;
    background-color: #dcb35c;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    position: relative;
}

.cell {
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cell:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.cell::before, .cell::after {
    content: '';
    position: absolute;
    background-color: rgba(0, 0, 0, 0.5);
}

.cell::before {
    width: 100%;
    height: 1px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.cell::after {
    width: 1px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

/* 棋子样式 */
.piece {
    position: absolute;
    width: 80%;
    height: 80%;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    animation: placeStone 0.3s ease;
}

@keyframes placeStone {
    0% { transform: translate(-50%, -50%) scale(0); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.black {
    background: radial-gradient(circle at 30% 30%, #555, #000);
    border: 1px solid #000;
}

.white {
    background: radial-gradient(circle at 30% 30%, #fff, #ccc);
    border: 1px solid #ccc;
}

.last-move {
    position: absolute;
    width: 30%;
    height: 30%;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
    animation: pulse 1s infinite;
}

.black-last-move {
    background-color: rgba(255, 255, 0, 0.7);
}

.white-last-move {
    background-color: rgba(255, 0, 0, 0.7);
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.7; }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
}

/* 棋盘动画 */
@keyframes boardAppear {
    0% {
        transform: scale(0.8) rotateX(30deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotateX(0);
        opacity: 1;
    }
}

/* 格子出现动画 */
@keyframes cellAppear {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 棋子放置动画 */
@keyframes pieceDrop {
    0% {
        transform: translateY(-20px) scale(0.8);
        opacity: 0.8;
    }
    50% {
        transform: translateY(5px) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* 棋子脉冲动画 */
@keyframes piecePulse {
    0% {
        box-shadow: 0 0 5px currentColor;
    }
    50% {
        box-shadow: 0 0 15px currentColor, 0 0 25px currentColor;
    }
    100% {
        box-shadow: 0 0 5px currentColor;
    }
}

/* 获胜棋子动画 */
@keyframes winningPiece {
    0% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 40px rgba(255, 215, 0, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }
}

/* 技能按钮激活动画 */
@keyframes skillButtonActive {
    0% {
        box-shadow: 0 0 5px currentColor;
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 15px currentColor, 0 0 25px currentColor;
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 5px currentColor;
        transform: scale(1);
    }
}

/* 主题切换过渡效果 */
.theme-transition {
    transition: all 0.5s ease;
}

/* 游戏状态信息动画 */
@keyframes statusUpdate {
    0% {
        transform: translateY(-10px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.status-message {
    animation: statusUpdate 0.3s ease-out;
}

/* 技能点更新动画 */
@keyframes skillPointUpdate {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
        color: var(--primary-color);
    }
    100% {
        transform: scale(1);
    }
}

.skill-points-updated {
    animation: skillPointUpdate 0.5s ease-out;
}

/* 控制按钮 */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.controls button {
    padding: 10px 20px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#undo-btn {
    background-color: #FF9800;
}

#hint-btn {
    background-color: #9C27B0;
}

#skill-btn {
    background-color: #E91E63;
}

/* 游戏统计 */
.game-stats {
    display: flex;
    justify-content: space-around;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.stats-item {
    text-align: center;
}

.stats-item span:first-child {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.stats-item span:last-child {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffeb3b;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
}

#winner-text {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #ffeb3b;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.modal-buttons button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.modal-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* 底部样式 */
footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    opacity: 0.7;
}

/* 提示样式 */
.hint-cell {
    position: relative;
}

.hint-cell::after {
    content: '';
    position: absolute;
    width: 50%;
    height: 50%;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 255, 0, 0.5);
    z-index: 5;
    animation: hintPulse 1s infinite;
}

@keyframes hintPulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.7; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.3; }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.7; }
}

/* 获胜连线样式 */
.winning-line {
    position: absolute;
    background-color: rgba(255, 215, 0, 0.7);
    z-index: 20;
    border-radius: 5px;
    animation: winningGlow 1s infinite alternate;
}

@keyframes winningGlow {
    from { box-shadow: 0 0 10px rgba(255, 215, 0, 0.7); }
    to { box-shadow: 0 0 20px rgba(255, 215, 0, 1); }
}

/* 技能系统样式 */
.skill-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.skill-item {
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.skill-item:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.5);
}

.skill-item h3 {
    margin-bottom: 5px;
    color: #ffeb3b;
}

.skill-item p {
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.skill-cost {
    display: block;
    font-size: 0.8rem;
    color: #ff9800;
    font-weight: bold;
}

/* 特殊棋子样式 */
.piece.shielded {
    position: relative;
}

.piece.shielded::after {
    content: '';
    position: absolute;
    width: 120%;
    height: 120%;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid #00bcd4;
    box-shadow: 0 0 10px #00bcd4;
    animation: shieldPulse 2s infinite;
}

@keyframes shieldPulse {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.7; }
    100% { transform: translate(-50%, -50%) scale(0.9); opacity: 1; }
}

/* 炸弹效果 */
.bomb-effect {
    position: absolute;
    width: 300%;
    height: 300%;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 0, 0, 0.8), transparent);
    z-index: 15;
    animation: bombExplode 0.5s ease-out forwards;
}

@keyframes bombExplode {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* 传送效果 */
.teleport-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    top: 0;
    left: 0;
    background: radial-gradient(circle, rgba(138, 43, 226, 0.8), transparent);
    z-index: 15;
    animation: teleport 0.8s ease-in-out forwards;
}

@keyframes teleport {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(0); opacity: 0; }
}

/* 粒子效果容器 */
.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

/* 落子粒子动画 */
.place-particle {
    animation: placeParticleAnimation 1s ease-out forwards;
}

@keyframes placeParticleAnimation {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--vx), var(--vy)) scale(0.3);
        opacity: 0;
    }
}

/* 粒子光环 */
.particle-ring {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid;
    transform: translate(-50%, -50%);
    animation: ringExpand 1s ease-out forwards;
}

@keyframes ringExpand {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/* 爆炸粒子动画 */
.explosion-particle {
    animation: explosionParticleAnimation 1s ease-out forwards;
}

@keyframes explosionParticleAnimation {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(calc(var(--vx) * 0.5), calc(var(--vy) * 0.5)) scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: translate(var(--vx), var(--vy)) scale(0.2);
        opacity: 0;
    }
}

/* 爆炸中心 */
.explosion-center {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 70%);
    transform: translate(-50%, -50%);
    animation: explodeCenter 0.5s ease-out forwards;
}

@keyframes explodeCenter {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* 冲击波效果 */
.shockwave {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 3px solid rgba(255, 100, 0, 0.7);
    transform: translate(-50%, -50%);
    animation: shockwaveExpand 1s ease-out forwards;
}

@keyframes shockwaveExpand {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(10);
        opacity: 0;
    }
}

/* 传送粒子动画 */
.teleport-particle {
    animation: teleportPulse 1s ease-out forwards;
}

@keyframes teleportPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
}

/* 传送门效果 */
.teleport-portal {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid;
    transform: translate(-50%, -50%);
    animation: portalRotate 1s linear infinite;
}

@keyframes portalRotate {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) rotate(180deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg) scale(0.5);
        opacity: 0;
    }
}

/* 烟花粒子动画 */
.firework-particle {
    animation: fireworkParticleAnimation 1.5s ease-out forwards;
}

@keyframes fireworkParticleAnimation {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(calc(var(--vx) * 0.5), calc(var(--vy) * 0.5)) scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: translate(var(--vx), calc(var(--vy) + 50px)) scale(0.2);
        opacity: 0;
    }
}

/* 烟花中心 */
.firework-center {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: white;
    transform: translate(-50%, -50%);
    animation: fireworkCenter 0.5s ease-out forwards;
}

@keyframes fireworkCenter {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* 胜利文字动画 */
.victory-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    font-weight: bold;
    text-shadow: 0 0 10px currentColor;
    animation: victoryTextAnimation 3s ease-out forwards;
    z-index: 1001;
}

@keyframes victoryTextAnimation {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .controls {
        flex-wrap: wrap;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 10px;
    }
}