body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: rgba(255, 255, 255, 0.1);
    overflow-x: hidden;
}

#chessboard {
    width: 90vw;
    max-width: 500px;
    margin: 20px auto;
    background-color: transparent;
}

@media (max-width: 600px) {
    #chessboard {
        width: 95vw;
    }
}

.highlight-square {
    background-color: rgba(255, 255, 0, 0.3) !important;
}

.highlight-move,
.highlight-capture {
    position: relative;
}

.highlight-move::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30%;
    height: 30%;
    background-color: rgba(0, 0, 0, 0.25);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.highlight-capture::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 60%;
    border: 3px solid rgba(255, 0, 0, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.selected-square {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.king-in-check {
    background-color: rgba(255, 0, 0, 0.5) !important;
    box-shadow: inset 0 0 10px rgba(255, 0, 0, 0.8);
}

#promotionModal {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9999;
}

#promotionModal.hidden {
    display: none;
}

#promotionModal>div {
    display: flex;
    gap: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    justify-content: center;
    align-items: center;
}

.promotion-piece {
    width: 64px;
    height: 64px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.promotion-piece:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
    border-radius: 8px;
}

.pause-btn,
.pause-menu,
.pause-menu h2,
.pause-menu-btn,
.pause-option,
#pauseModal {
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

#pauseModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(94, 94, 94, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.pause-menu {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px 28px;
    border-radius: 20px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45);
    text-align: center;
    width: 260px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pause-menu h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: white;
}

.pause-menu-btn {
    border: none;
    padding: 10px;
    font-size: 1rem;
    color: white;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    background-size: 200% 200%;
    font-weight: 600;
}

#resumeGame {
    background: linear-gradient(135deg, #34d399, #059669);
}

#pauseMenuExitGame {
    background: linear-gradient(135deg, #f87171, #dc2626);
}

.pause-menu-btn:hover,
gameover-exit-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.pause-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 14px;
    border-radius: 12px;
    gap: 12px;
    font-size: 0.95rem;
    color: white;
    transition: background 0.2s ease;
}

.pause-option span {
    font-weight: 500;
}

.toggle-btn {
    min-width: 80px;
    padding: 6px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    background: #4a4a4a;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.pause-option input[type="checkbox"] {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid #fff;
    background: #4a4a4a;
    cursor: pointer;
    position: relative;
    appearance: none;
    outline: none;
    transition: all 0.2s ease;
}

.pause-option input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 10px;
    border: solid transparent;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -50%) rotate(45deg);
    transition: all 0.2s ease;
}

.pause-option input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #34d399, #059669);
    border-color: #34d399;
}

.pause-option input[type="checkbox"]:checked::before {
    border-color: white;
}

.pause-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #5E5E5E;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    font-size: 22px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    font-weight: 600;
}

.pause-btn:hover {
    background: #4a4a4a;
}

button,
input,
.toggle-btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.hidden {
    display: none !important;
}

#gameOverModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(94, 94, 94, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

#gameOverModal,
.gameover-menu,
.gameover-menu h2,
.gameover-reason,
.gameover-difficulty,
.gameover-btn {
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

.gameover-menu {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 24px 32px;
    border-radius: 20px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45);
    text-align: center;
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 8px; 
}

.gameover-reason,
.gameover-difficulty {
    font-size: 1.05rem;
    font-weight: 500;
    color: #f1f1f1;
    line-height: 1.5;
    letter-spacing: 0.3px;
    text-align: center;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

#gameOverTitle {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
}

.gameover-reason {
    margin-bottom: 1px;
}

.gameover-difficulty {
    margin-top: 0;
    margin-bottom: 16px;
}

.gameover-analyze-btn,
.gameover-exit-btn {
    margin-top: 2px; 
}

.gameover-btn {
    border: none;
    padding: 10px;
    font-size: 1rem;
    color: white;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    font-weight: 600;
}

.gameover-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.gameover-win #gameOverTitle {
    color: #34d399;
}

.gameover-lose #gameOverTitle {
    color: #f87171;
}

.gameover-draw #gameOverTitle {
    color: #facc15;
}

.gameover-exit-btn {
    border: none;
    padding: 10px;
    font-size: 1rem;
    color: white;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    background-size: 200% 200%;
    font-weight: 600;
    background: linear-gradient(135deg, #f87171, #dc2626);
}

.gameover-exit-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.gameover-analyze-btn {
    border: none;
    padding: 10px;
    font-size: 1rem;
    color: white;
    border-radius: 12px;
    cursor: not-allowed;
    transition: transform 0.2s ease, opacity 0.2s ease;
    background-size: 200% 200%;
    font-weight: 600;
    background: linear-gradient(135deg, #34d399, #059669);
    opacity: 0.6;
}
