:root {
    --board-color: #dcb35c;
    --line-color: #000000;
    --black-piece: #000000;
    --white-piece: #ffffff;
    --highlight: #ffeb3b;
    --shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f);
    color: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(5px);
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 2.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.game-area {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
}

.board-container {
    flex: 1;
    min-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.board {
    width: 500px;
    height: 500px;
    background: var(--board-color);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
}

.grid {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    position: relative;
}

/* 修复：确保交叉点正确对齐 */
.intersection {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
}

.intersection::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    transition: var(--transition);
}

.intersection:hover::before {
    background: rgba(0, 0, 0, 0.2);
}

/* 修复：棋子定位 */
.piece {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    box-shadow: var(--shadow);
    z-index: 1;
    transition: var(--transition);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.piece.placed {
    animation: placePiece 0.3s ease-out;
}

@keyframes placePiece {
    0% { transform: translate(-50%, -50%) scale(0); }
    70% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

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

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

.last-move::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--highlight);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    animation: pulse 1.5s infinite;
}

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

/* 添加棋盘网格线 */
.grid-line {
    position: absolute;
    background: var(--line-color);
}

.horizontal-line {
    width: 100%;
    height: 1px;
    left: 0;
}

.vertical-line {
    width: 1px;
    height: 100%;
    top: 0;
}

.info-panel {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-info {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.player-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: var(--shadow);
}

.black-icon {
    background: #000;
    color: white;
}

.white-icon {
    background: #fff;
    color: #333;
}

.current-turn {
    border: 2px solid #4CAF50;
}

.controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.btn-primary {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0), rgba(13, 71, 161, 0));
    color: white;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.thinking {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.thinking-dots {
    display: flex;
    gap: 5px;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    animation: bounce 1.5s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal.show {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(-50px);
    transition: var(--transition);
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal h2 {
    color: #333;
    margin-bottom: 15px;
}

.api-status {
    margin-top: 10px;
    font-size: 0.9rem;
}

.api-status.connected {
    color: #4CAF50;
}

.api-status.error {
    color: #f44336;
}

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

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #4CAF50;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 添加星位标记 */
.star-point {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #000;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

@media (max-width: 768px) {
    .board {
        width: 400px;
        height: 400px;
    }

    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .board {
        width: 300px;
        height: 300px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .controls {
        flex-direction: column;
    }

    .piece {
        width: 20px;
        height: 20px;
    }
}