* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: linear-gradient(135deg, #1a0a00 0%, #2d1810 50%, #1a0a00 100%);
    min-height: 100vh; display: flex; justify-content: center; align-items: center;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif; color: #e8d5b0;
}

#app { padding: 20px; }

#header h1 {
    text-align: center; font-size: 32px; letter-spacing: 12px; margin-bottom: 20px;
    color: #f0d080; text-shadow: 0 2px 8px rgba(240, 180, 60, 0.4);
    font-family: "KaiTi", "楷体", serif;
    width: 100%;
}

#board-wrapper { display: flex; flex-direction: column; align-items: center; }

#main-container { display: flex; gap: 40px; align-items: flex-end; }

#board-container {
    background: #3a2010; border-radius: 12px; padding: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
    border: 2px solid #5a3a20;
}

canvas { display: block; cursor: pointer; }

#side-panel {
    width: 200px; display: flex; flex-direction: column; gap: 10px;
    height: 656px;
}

.panel {
    background: rgba(60, 35, 15, 0.85); border-radius: 8px; padding: 14px;
    border: 1px solid #5a3a20;
}

.panel h3 {
    font-size: 14px; color: #c0a070; margin-bottom: 10px; letter-spacing: 2px;
    border-bottom: 1px solid #5a3a20; padding-bottom: 6px;
}

.mode-btn, .diff-btn, #action-panel button, #online-panel button {
    width: 100%; padding: 8px; margin-bottom: 6px; border: 1px solid #6a4a28;
    border-radius: 6px; background: linear-gradient(180deg, #5a3a1a, #3a2010);
    color: #e8d5b0; font-size: 13px; cursor: pointer; transition: all 0.2s;
    font-family: inherit;
}

.mode-btn:hover, .diff-btn:hover, #action-panel button:hover, #online-panel button:hover {
    background: linear-gradient(180deg, #7a5a2a, #5a3a1a); border-color: #8a6a38;
}

.mode-btn.active, .diff-btn.active {
    background: linear-gradient(180deg, #8a6020, #6a4010);
    border-color: #c09030; color: #ffe0a0;
    box-shadow: 0 0 8px rgba(200, 150, 50, 0.3);
}

#ai-diff-group {
    display: none; gap: 4px; margin-bottom: 6px;
}
#ai-diff-group.show { display: flex; }

#ai-diff-group .diff-btn {
    flex: 1; margin-bottom: 0; padding: 6px 0; font-size: 12px;
}

#turn-info {
    font-size: 16px; text-align: center; padding: 8px;
    font-family: "KaiTi", "楷体", serif; font-weight: bold;
}

#game-msg {
    text-align: center; font-size: 13px; color: #f0a040; min-height: 20px;
    margin-top: 4px;
}

#server-ip, #room-id {
    width: 100%; padding: 6px 8px; margin-bottom: 6px; border: 1px solid #6a4a28;
    border-radius: 4px; background: #2a1508; color: #e8d5b0; font-size: 13px;
    font-family: inherit;
}

#room-info { font-size: 13px; color: #a0d060; text-align: center; padding: 4px; }

#move-history {
    overflow-y: auto; font-size: 12px; line-height: 1.8;
    font-family: "KaiTi", "楷体", monospace; flex: 1; white-space: pre-line;
}

#history-panel { flex: 1; display: flex; flex-direction: column; }

#move-history::-webkit-scrollbar { width: 4px; }
#move-history::-webkit-scrollbar-thumb { background: #5a3a20; border-radius: 2px; }

.hidden { display: none !important; }

.turn-red { color: #ff6040; }
.turn-black { color: #e8d5b0; }

/* 胜利弹窗 */
#victory-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    display: flex; justify-content: center; align-items: center;
    animation: fadeIn 0.3s ease;
}
#victory-overlay.victory-hidden { display: none; }

#victory-dialog {
    background: linear-gradient(160deg, #3a2010 0%, #2a1508 100%);
    border: 2px solid #8a6a38;
    border-radius: 16px; padding: 40px 50px; text-align: center;
    box-shadow: 0 0 40px rgba(200, 150, 50, 0.3), 0 16px 48px rgba(0, 0, 0, 0.6);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 300px;
}

#victory-icon { font-size: 48px; margin-bottom: 12px; }

#victory-title {
    font-size: 30px; font-weight: bold; letter-spacing: 6px;
    font-family: "KaiTi", "楷体", serif;
    text-shadow: 0 2px 12px rgba(240, 180, 60, 0.5);
    margin-bottom: 10px;
}
#victory-title.winner-red { color: #ff6040; }
#victory-title.winner-black { color: #e8d5b0; }
#victory-title.winner-draw { color: #f0d080; }

#victory-reason {
    font-size: 14px; color: #c0a070; margin-bottom: 28px;
    font-family: "KaiTi", "楷体", serif;
}

#victory-btn {
    padding: 10px 36px; border: 1px solid #c09030; border-radius: 8px;
    background: linear-gradient(180deg, #8a6020, #5a3a1a);
    color: #ffe0a0; font-size: 15px; cursor: pointer;
    font-family: "KaiTi", "楷体", serif; letter-spacing: 4px;
    transition: all 0.2s;
}
#victory-btn:hover {
    background: linear-gradient(180deg, #a07828, #7a5a2a);
    border-color: #e0b040;
    box-shadow: 0 0 12px rgba(200, 150, 50, 0.4);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#music-controls { display: flex; align-items: center; gap: 6px; }

#music-panel { flex-shrink: 0; overflow: hidden; }

#btn-music-toggle {
    width: 28px; height: 28px; padding: 0; border: 1px solid #6a4a28; border-radius: 50%;
    background: linear-gradient(180deg, #5a3a1a, #3a2010);
    color: #e8d5b0; font-size: 16px; cursor: pointer; transition: all 0.2s;
    flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    line-height: 1;
}
#btn-music-toggle:hover {
    background: linear-gradient(180deg, #7a5a2a, #5a3a1a); border-color: #8a6a38;
}
#btn-music-toggle.playing { border-color: #c09030; color: #ffe0a0; }

#volume-slider {
    flex: 1; height: 4px; -webkit-appearance: none; appearance: none;
    background: #5a3a20; border-radius: 2px; outline: none; cursor: pointer;
    min-width: 0; max-width: 100px;
}
#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
    background: linear-gradient(180deg, #f0d080, #c09030); border: 1px solid #8a6a38;
    cursor: pointer;
}
#volume-val { min-width: 28px; text-align: right; font-size: 11px; color: #c0a070; flex-shrink: 0; margin-right: 2px; }
