@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=ZCOOL+XiaoWei&display=swap');

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

body {
    font-family: 'ZCOOL XiaoWei', serif;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 0, 0, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 0, 0, 0.07) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(0, 0, 0, 0.03) 0%, transparent 40%),
        linear-gradient(135deg, #f5f2e8 0%, #e8e3d3 50%, #f0ead6 100%);
    color: #2a2a2a;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* 水墨背景效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600" viewBox="0 0 600 600"><defs><filter id="ink"><feTurbulence type="fractalNoise" baseFrequency="0.02" numOctaves="4" seed="5"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"/></filter></defs><rect width="600" height="600" filter="url(%23ink)" opacity="0.4"/></svg>') no-repeat,
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="800" height="800" viewBox="0 0 800 800"><defs><filter id="ink2"><feTurbulence type="fractalNoise" baseFrequency="0.01" numOctaves="3" seed="2"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/></filter></defs><rect width="800" height="800" filter="url(%23ink2)" opacity="0.3"/></svg>') no-repeat;
    background-size: cover, cover;
    background-position: center, center;
    opacity: 0.7;
    z-index: -1;
    pointer-events: none;
}

/* 墨金装饰元素 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" viewBox="0 0 400 400"><defs><linearGradient id="gold" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" stop-color="%23d4af37" stop-opacity="0.1"/><stop offset="50%" stop-color="%23f9f295" stop-opacity="0.2"/><stop offset="100%" stop-color="%23d4af37" stop-opacity="0.1"/></linearGradient></defs><path d="M50,50 Q200,100 350,50 Q300,200 350,350 Q200,300 50,350 Q100,200 50,50" fill="url(%23gold)" stroke="%23d4af37" stroke-width="0.5" opacity="0.3"/></svg>') no-repeat top right,
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300" viewBox="0 0 300 300"><defs><linearGradient id="gold2" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" stop-color="%23d4af37" stop-opacity="0.1"/><stop offset="50%" stop-color="%23f9f295" stop-opacity="0.2"/><stop offset="100%" stop-color="%23d4af37" stop-opacity="0.1"/></linearGradient></defs><circle cx="150" cy="150" r="100" fill="none" stroke="url(%23gold2)" stroke-width="1" opacity="0.4"/></svg>') no-repeat bottom left;
    background-size: 300px 300px, 250px 250px;
    opacity: 0.5;
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px;
    position: relative;
}

header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

header h1 {
    font-family: 'Ma Shan Zheng', cursive;
    color: #1a1a1a;
    font-size: 3.5rem;
    margin-bottom: 15px;
    text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: 5px;
    position: relative;
    display: inline-block;
    background: linear-gradient(45deg, #1a1a1a, #d4af37, #1a1a1a);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-fill-color: transparent;
}

header h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 10%;
    width: 80%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #d4af37, transparent);
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-controls {
    width: 100%;
    background: linear-gradient(135deg, rgba(255, 253, 245, 0.9), rgba(250, 245, 230, 0.85));
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 0 0 10px rgba(212, 175, 55, 0.1);
    position: relative;
    overflow: hidden;
}

/* 水墨纹理 */
.game-controls::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><filter id="ink-texture"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" seed="3"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0"/></filter><rect width="200" height="200" filter="url(%23ink-texture)"/></svg>');
    opacity: 0.15;
    pointer-events: none;
}

/* 墨金边框装饰 */
.game-controls::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.7), transparent);
}

.mode-selection {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

.difficulty-selection {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

.difficulty-selection span {
    font-size: 1.1rem;
    margin-right: 10px;
    color: #3a2a1a;
}

.difficulty-select {
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(212, 175, 55, 0.4);
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 1rem;
    font-family: 'ZCOOL XiaoWei', serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.difficulty-select:hover {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(212, 175, 55, 0.7);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 5px rgba(212, 175, 55, 0.2);
}

.difficulty-select:focus {
    outline: none;
    border-color: rgba(212, 175, 55, 0.9);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.mode-btn {
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(212, 175, 55, 0.4);
    padding: 12px 25px;
    margin: 0 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    font-family: 'ZCOOL XiaoWei', serif;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.2), transparent);
    transition: left 0.5s;
}

.mode-btn:hover::before {
    left: 100%;
}

.mode-btn:hover {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(212, 175, 55, 0.7);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 5px rgba(212, 175, 55, 0.2);
}

.mode-btn.active {
    background: linear-gradient(to bottom, rgba(212, 175, 55, 0.8), rgba(212, 175, 55, 0.9));
    color: white;
    border-color: rgba(212, 175, 55, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 0 8px rgba(212, 175, 55, 0.3);
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    font-size: 1.2rem;
    position: relative;
    z-index: 1;
}

.current-player {
    font-weight: bold;
    color: #3a2a1a;
    text-shadow: 0px 0px 1px rgba(212, 175, 55, 0.5);
}

.game-status {
    color: #4e6b31;
    font-weight: bold;
    text-shadow: 0px 0px 1px rgba(212, 175, 55, 0.3);
}

.game-actions {
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.action-btn {
    background: linear-gradient(to bottom, rgba(212, 175, 55, 0.7), rgba(212, 175, 55, 0.8));
    color: white;
    border: 1px solid rgba(212, 175, 55, 0.5);
    padding: 12px 25px;
    margin: 0 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    font-family: 'ZCOOL XiaoWei', serif;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1), 0 0 5px rgba(212, 175, 55, 0.2);
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:hover {
    background: linear-gradient(to bottom, rgba(212, 175, 55, 0.8), rgba(212, 175, 55, 0.9));
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 0 10px rgba(212, 175, 55, 0.4);
}

.game-board-container {
    position: relative;
    margin-bottom: 25px;
    padding: 15px;
    background: linear-gradient(135deg, rgba(245, 242, 235, 0.8), rgba(240, 235, 225, 0.7));
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 0 0 10px rgba(212, 175, 55, 0.1);
    overflow: hidden;
}

/* 棋盘水墨纹理 */
.game-board-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300" viewBox="0 0 300 300"><filter id="board-texture"><feTurbulence type="fractalNoise" baseFrequency="0.5" numOctaves="3" seed="1"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"/></filter><rect width="300" height="300" filter="url(%23board-texture)"/></svg>');
    opacity: 0.3;
    pointer-events: none;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(15, 35px);
    grid-template-rows: repeat(15, 35px);
    gap: 0;
    background: linear-gradient(to right, #daa520, #b8860b);
    border: 2px solid #8b4513;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2), 0 0 5px rgba(212, 175, 55, 0.2);
    position: relative;
    overflow: hidden;
    z-index: 1;
    padding: 17.5px; /* 为边框留出空间 */
}

/* 棋盘网格线 */
.game-board::before {
    content: '';
    position: absolute;
    top: 17.5px;
    left: 17.5px;
    right: 17.5px;
    bottom: 17.5px;
    background-image: 
        linear-gradient(to right, #000 1px, transparent 1px),
        linear-gradient(to bottom, #000 1px, transparent 1px);
    background-size: 35px 35px;
    background-position: 17.5px 17.5px;
    pointer-events: none;
}

/* 棋盘边框 */
.game-board::after {
    content: '';
    position: absolute;
    top: 17.5px;
    left: 17.5px;
    right: 17.5px;
    bottom: 17.5px;
    border: 1px solid #000;
    pointer-events: none;
    z-index: 2;
}

.cell {
    width: 35px;
    height: 35px;
    position: relative;
    cursor: pointer;
    z-index: 3;
}

/* 棋盘交叉点 */
.cell::before {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: #000;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.8;
}

/* 特殊位置（天元和星） */
.cell.special-point::before {
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, #000, #333);
    opacity: 1;
}

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

.piece {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.piece.black {
    background: radial-gradient(circle at 30% 30%, #333, #000);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.8), inset 0 0 5px rgba(255, 255, 255, 0.1);
}

.piece.white {
    background: radial-gradient(circle at 30% 30%, #fff, #e0e0e0);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5), inset 0 0 5px rgba(0, 0, 0, 0.1);
}

.piece.last-move::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, #ff0000, #8b0000);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.8);
}

.game-result {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.result-content {
    background: linear-gradient(135deg, rgba(255, 253, 245, 0.95), rgba(250, 245, 230, 0.9));
    padding: 40px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(212, 175, 55, 0.3);
    border: 1px solid rgba(212, 175, 55, 0.3);
    position: relative;
    overflow: hidden;
}

/* 结果弹窗水墨纹理 */
.result-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><filter id="result-texture"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3" seed="2"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"/></filter><rect width="200" height="200" filter="url(%23result-texture)"/></svg>');
    opacity: 0.2;
    pointer-events: none;
}

/* 结果弹窗墨金边框 */
.result-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 8px;
    pointer-events: none;
}

.result-content h2 {
    font-family: 'Ma Shan Zheng', cursive;
    margin-bottom: 25px;
    font-size: 2.5rem;
    background: linear-gradient(45deg, #1a1a1a, #d4af37, #1a1a1a);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-fill-color: transparent;
    position: relative;
    z-index: 1;
}

@media (max-width: 600px) {
    .game-board {
        grid-template-columns: repeat(15, 25px);
        grid-template-rows: repeat(15, 25px);
        padding: 12.5px; /* 为边框留出空间 */
    }
    
    .game-board::before {
        top: 12.5px;
        left: 12.5px;
        right: 12.5px;
        bottom: 12.5px;
        background-size: 25px 25px;
        background-position: 12.5px 12.5px;
    }
    
    .game-board::after {
        top: 12.5px;
        left: 12.5px;
        right: 12.5px;
        bottom: 12.5px;
    }
    
    .cell {
        width: 25px;
        height: 25px;
    }
    
    .piece {
        width: 20px;
        height: 20px;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
    
    .container {
        padding: 20px 10px;
    }
}