body {
    margin: 0;
    padding: 0;
    background: #111;
    color: #eee;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.game-container {
    display: flex;
    gap: 20px;
    align-items: stretch;
    background: #1e1e1e;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    height: 90vh;
    max-width: 1400px;
    margin: 0 auto;
}

.sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.board-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #252525;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #333;
    flex: 1; /* Allow board to take available space */
    position: relative;
}

/* Specific for Xiangqi Board */
#xiangqiboard {
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    background: url('../game/images/boards/board-ccbridge.png') no-repeat center center;
    background-size: 100% 100%;
    padding: 5px;
    border: 3px solid #6d4c41;
    border-radius: 4px;
}

/* Player Cards */
.player-card {
    background: #2a2a2a;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid transparent;
    transition: 0.3s;
}

.player-card.active {
    background: #333;
    border-left-color: #00f6ff;
    box-shadow: 0 0 10px rgba(0, 246, 255, 0.1);
}

.player-card .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.player-card .info {
    flex: 1;
}

.player-card .name {
    font-weight: bold;
    font-size: 14px;
}

.player-card .sub {
    font-size: 11px;
    color: #888;
}

.player-card .timer {
    font-family: 'Consolas', monospace;
    font-size: 18px;
    background: #000;
    padding: 5px 10px;
    border-radius: 4px;
    color: #00f6ff;
    min-width: 60px;
    text-align: center;
}

.game-info {
    flex: 1;
    background: #222;
    border-radius: 8px;
    padding: 10px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 13px;
    color: #aaa;
}

#status {
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #333;
}

/* Controls */
.title {
    margin: 0;
    font-size: 18px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 10px;
}

.btn-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap; /* Handle many bots */
}

.btn-level {
    flex: 1;
    background: #333;
    border: 1px solid #444;
    color: #aaa;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
}

.btn-level:hover, .btn-level.active {
    background: #00f6ff;
    color: #000;
    font-weight: bold;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-action {
    padding: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: 0.2s;
}

.btn-action.primary {
    background: #00f6ff;
    color: #000;
    box-shadow: 0 0 15px rgba(0, 246, 255, 0.3);
}
.btn-action.primary:hover {
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 246, 255, 0.6);
}

.btn-action.secondary {
    background: #444;
    color: #fff;
}
.btn-action.secondary:hover { background: #555; }

.btn-secondary {
    background: #444;
    color: #fff;
    border: 1px solid #555;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}
.btn-secondary:hover {
    background: #555;
    border-color: #777;
}

.btn-action.undo {
    background: #5c3c0d;
    color: #ffcc00;
}
.btn-action.quit {
    background: #330000;
    color: #ff4444;
    margin-top: auto;
}

/* Analysis */
.analysis-controls {
    margin-top: 15px;
    background: #2a2a2a;
    padding: 10px;
    border-radius: 8px;
    width: 100%; /* Fill container */
    max-width: 550px; /* Limit width */
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.eval-box {
    background: #111;
    color: #00f6ff;
    padding: 8px;
    border-radius: 4px;
    text-align: center;
    font-family: monospace;
    font-size: 14px;
    border: 1px solid #333;
}
.controls-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}
.graph-container {
    background: #1a1a1a;
    border-radius: 4px;
    padding: 5px;
    margin-bottom: 10px;
    height: 100px;
    position: relative;
    width: 100%;
}
canvas#evalGraph {
    width: 100% !important;
    height: 100% !important;
}
.move-feedback {
    min-height: 20px;
    font-size: 13px;
    text-align: center;
    margin-bottom: 5px;
    font-weight: bold;
}
.move-feedback.blunder { color: #ff3333; }
.move-feedback.mistake { color: #ffcc00; }
.move-feedback.good { color: #33ff33; }
.full-width { width: 100%; margin-top: 5px; }
.btn-control {
    background: #444;
    border: none;
    color: #fff;
    width: 40px;
    height: 35px;
    border-radius: 4px;
    cursor: pointer;
}
.btn-control:hover { background: #555; }
.btn-control.exit { background: #550000; color: #ff5555; margin-left: auto; }

/* History */
.history-panel {
    background: #222;
    border-radius: 8px;
    padding: 10px;
    flex: 1;
    overflow-y: auto;
    margin-top: 10px;
    max-height: 250px;
}
.panel-title { font-size: 14px; color: #888; margin: 0 0 10px 0; border-bottom: 1px solid #333; padding-bottom: 5px; }
.history-item {
    font-size: 13px;
    padding: 8px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.history-item:hover { background: #333; }
.history-item .info-group { display: flex; flex-direction: column; gap: 2px; }
.history-item .result { font-weight: bold; }
.history-item .result.win { color: #00f6ff; }
.history-item .result.loss { color: #ff4444; }
.history-item .result.draw { color: #aaa; }

.btn-delete {
    background: transparent;
    border: none;
    color: #444;
    cursor: pointer;
    padding: 5px;
    transition: 0.2s;
    font-size: 14px;
}
.btn-delete:hover { color: #ff4444; }

/* Engine Eval Bar specific for Xiangqi (Vertical bar next to board maybe?) */
.engine-eval {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 200px;
    margin-top: 10px;
    background: #222;
    padding: 5px;
    border-radius: 4px;
}
.eval-bar-container {
    width: 20px;
    background: #444;
    flex: 1;
    position: relative;
    border-radius: 2px;
    overflow: hidden;
}
#eval-bar {
    background: #00f6ff;
    width: 100%;
    position: absolute;
    bottom: 0;
    transition: height 0.5s;
}
#eval-score {
    margin-top: 5px;
    font-size: 12px;
    font-family: monospace;
    color: #fff;
}
