:root {
    --bg: #0d1117;
    --panel: #0f1624;
    --fg: #c9d1d9;
    --muted: #8b949e;
    --border: #1f2937;
    --accent: #58a6ff;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #fbbf24;
    --orange: #f59e0b;
    --purple: #8b5cf6;
    --blue: #3b82f6;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, sans-serif;
    min-height: 100vh; 
}

/* --- Layout --- */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.brand { color: var(--accent); font-weight: 700; font-size: 1.5rem; }
.actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
input[type="number"] {
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--fg);
    padding: 0.5rem;
    border-radius: 4px;
    width: 60px;
    text-align: center;
}
button {
    background: var(--accent);
    color: var(--bg);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 600;
}
button:hover { background: var(--blue); }

.grid {
    display: grid;
    /* Sets the board area to 600px wide */
    grid-template-columns: 600px 1fr; 
    gap: 20px;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}
@media (max-width: 1000px) {
    .grid {
        grid-template-columns: 1fr; 
        max-width: 95%;
    }
}


.board-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.sidebar {
    background: var(--panel);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.sidebar h3 {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--accent);
}

/* CRITICAL: Chessboard.js container sizing */
#board {
    width: 100%;
    max-width: 600px; 
    margin: 0 auto;
}

/* --- Board Controls and Info --- */

.controls {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.evalinfo {
    display: flex;
    justify-content: space-between;
    padding-top: 5px;
}

.symbol {
    font-weight: 700;
}
.excellent { color: var(--green); }
.blunder { color: var(--red); }
.muted { color: var(--muted); }

/* --- Evaluation Bar (Horizontal Style) --- */

.evalbar {
    position: relative;
    height: 15px; 
    background: var(--fg); /* White side */
    border-radius: 4px;
    overflow: hidden;
    max-width: 100%;
}

.evalfill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 50%; 
    background: var(--bg); /* Black side */
    transition: width 0.5s ease-out;
}

.evalticks {
    position: absolute;
    top: -20px; 
    left: 0;
    right: 0;
    height: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 0.7rem;
    color: var(--muted);
}
.evalticks .center-line { 
    font-weight: 700;
    color: var(--fg);
}


/* --- Sidebar Content --- */

.pgnbox textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--fg);
    padding: 0.5rem;
    border-radius: 4px;
    resize: vertical;
    font-family: monospace;
}
.pgn-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.summary {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.movelist {
    height: 300px;
    overflow-y: auto;
    background: var(--bg);
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.movelist table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; 
}
.movelist th, .movelist td {
    padding: 4px 8px;
    text-align: left;
    white-space: nowrap; 
}
.movelist thead th {
    color: var(--accent);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 2;
}
.movelist td:nth-child(1) { 
    width: 15%;
    font-weight: 700;
    color: var(--muted);
}
.movelist td:nth-child(2) { 
    width: 42%;
}
.movelist td:nth-child(3) { 
    width: 43%;
}

@media (max-width: 1000px) {
    .board-panel {
        align-items: center;
    }
}
/* --- Move Annotation Styles (Add this to the end of styles.css) --- */

.annotation {
    font-weight: 700;
    margin-left: 5px;
    padding: 1px 4px; /* Gives space around the symbol */
    border-radius: 4px; 
    font-size: 0.8rem;
    vertical-align: middle;
    /* Display as inline-block to allow padding/margin on text */
    display: inline-block; 
    line-height: 1; /* Ensures text is vertically centered in the box */
}

/* Brilliance (!!) */
.brilliance {
    color: var(--bg); /* Dark text color from your palette */
    background: var(--cyan); /* Bright background for impact */
    border: 1px solid var(--cyan);
}

/* Excellent/Good Move (!) */
.good-move {
    color: var(--bg);
    background: var(--green);
    border: 1px solid var(--green);
}

/* Mistake (?) */
.mistake {
    color: var(--bg);
    background: var(--yellow);
    border: 1px solid var(--yellow);
}

/* Blunder (??) */
.blunder-move {
    color: var(--fg); /* Light text color */
    background: var(--red);
    border: 1px solid var(--red);
}
