@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #0f1117;
    color: #e2e8f0;
    font-family: 'DM Sans', sans-serif;
}

#main {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
}

#game {
    position: relative;
    background: #1e2130;
    border: 1px solid #2d3348;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 452px;
}

#game::before {
    content: 'Stockfish Engine — Move Analyzer';
    display: block;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
    margin-bottom: 16px;
    color: #64748b;
}

#board {
    border: 1px solid #2d3348 !important;
    border-radius: 4px;
}

#controls {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
    margin-top: 16px;
    margin-bottom: 16px;
}

select {
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    background-color: #1e2130;
    color: #e2e8f0;
    border: 1px solid #2d3348;
    padding: 9px 30px 9px 12px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    flex-grow: 1;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path fill='%2364748b' d='M0 3l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: calc(100% - 12px) center;
    transition: border-color 0.15s;
}

select:hover, select:focus {
    border-color: #475569;
}

button {
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    background: #2563eb;
    flex-grow: 2;
    transition: background 0.15s;
}

button:hover {
    background: #1d4ed8;
}

#moveTerminal {
    width: 100%;
    height: 100px;
    background: #151722;
    border: 1px solid #2d3348;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    color: #94a3b8;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#moveTerminal div::before {
    content: "→ ";
    color: #2563eb;
}

#moveTerminal::-webkit-scrollbar { width: 4px; }
#moveTerminal::-webkit-scrollbar-track { background: #151722; }
#moveTerminal::-webkit-scrollbar-thumb {
    background: #2d3348;
    border-radius: 2px;
}

#gameOverPopup {
    display: none;
    position: absolute;
    top: 57px;
    left: 20px;
    width: 400px;
    height: 400px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(30, 33, 48, 0.95);
    backdrop-filter: blur(6px);
    border: 1px solid #2d3348;
    border-radius: 8px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

#gameOverPopup h1 {
    font-size: 24px;
    font-weight: 500;
    color: #e2e8f0;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

#gameOverPopup::after {
    content: "Click anywhere to continue";
    font-size: 13px;
    color: #475569;
}

.ad-placeholder {
    background: #151722;
    border: 1px dashed #2d3348;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 11px;
    font-family: 'DM Sans', sans-serif;
}

#ad-top { width: 728px; height: 90px; }
#ad-sidebar-left, #ad-sidebar-right { width: 160px; height: 600px; }

.white-1e1d7 {
    background-color: #b8c9e0 !important;
}

.black-3c85d {
    background-color: #4a6fa5 !important;
}

.white-1e1d7 .notation-322f9 {
    color: #4a6fa5 !important;
}

.black-3c85d .notation-322f9 {
    color: #b8c9e0 !important;
}