/* ========== 基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #e8e8e8;
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
}

/* ========== 左侧菜单栏（Windows风格） ========== */
.sidebar {
    width: 200px;
    min-width: 200px;
    height: 100%;
    background: linear-gradient(180deg, #2b5797 0%, #1e3f6f 100%);
    color: white;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
}

.sidebar.collapsed {
    width: 40px;
    min-width: 40px;
}

.sidebar-toggle {
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(0,0,0,0.2);
    font-size: 1.2rem;
    transition: background 0.2s;
    user-select: none;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(0,0,0,0.3);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed .sidebar-content {
    display: none;
}

.menu-section {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.menu-section:last-child {
    border-bottom: none;
}

.menu-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 8px;
}

/* ========== 游戏状态（菜单内） ========== */
.game-status {
    font-size: 1rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 4px;
    text-align: center;
}

.status-playing {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.status-win {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ========== 玩家指示器 ========== */
.player-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.stone-preview {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

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

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

.current-player {
    font-size: 0.95rem;
    font-weight: 500;
}

.move-counter {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    margin-top: 4px;
}

/* ========== 菜单按钮（白色硅胶质感） ========== */
.menu-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(145deg, #ffffff 0%, #f0f0f0 100%);
    color: #2c3e50;
    box-shadow:
            0 2px 4px rgba(0,0,0,0.1),
            inset 0 1px 0 rgba(255,255,255,0.5);
    margin-bottom: 6px;
}

.menu-btn:hover {
    background: linear-gradient(145deg, #ffffff 0%, #e8e8e8 100%);
    box-shadow:
            0 3px 6px rgba(0,0,0,0.15),
            inset 0 1px 0 rgba(255,255,255,0.5);
}

.menu-btn:active {
    box-shadow:
            0 1px 2px rgba(0,0,0,0.1),
            inset 0 1px 0 rgba(255,255,255,0.5);
}

/* ========== 游戏规则 ========== */
.instructions {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    line-height: 1.6;
}

.instructions li {
    list-style: none;
    padding: 2px 0;
    position: relative;
    padding-left: 12px;
}

.instructions li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: rgba(255,255,255,0.4);
}

/* ========== 主内容区 ========== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
    min-width: 0;
    height: 100%;
}

/* ========== 比分栏（棋盘上方） ========== */
.score-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 10px;
    background: white;
    padding: 8px 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.score-team {
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-stone {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.score-info {
    display: flex;
    flex-direction: column;
}

.score-label {
    font-size: 0.7rem;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
}

.score-vs {
    font-size: 1rem;
    color: #95a5a6;
    font-weight: 300;
}

/* ========== 棋盘区域 ========== */
.board-wrapper {
    background: linear-gradient(145deg, #e8d5b7 0%, #c4a882 100%);
    padding: 10px;
    border-radius: 12px;
    box-shadow:
            0 10px 30px rgba(0,0,0,0.2),
            inset 0 2px 5px rgba(255,255,255,0.3);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.board-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
            radial-gradient(circle at 20% 20%, rgba(255,255,255,0.1) 0%, transparent 50%),
            radial-gradient(circle at 80% 80%, rgba(0,0,0,0.05) 0%, transparent 50%);
    border-radius: 12px;
    pointer-events: none;
}

#gameCanvas {
    display: block;
    cursor: pointer;
    border-radius: 6px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

/* ========== 响应式布局 ========== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
    }

    .main-content {
        padding: 8px;
    }

    .score-bar {
        padding: 6px 16px;
        gap: 20px;
    }

    .score-value {
        font-size: 1.2rem;
    }

    .board-wrapper {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 160px;
        min-width: 160px;
    }

    .sidebar.collapsed {
        width: 36px;
        min-width: 36px;
    }

    .score-bar {
        padding: 4px 12px;
        gap: 12px;
        font-size: 0.85rem;
    }

    .score-value {
        font-size: 1rem;
    }
}
