body {
    touch-action: manipulation;
}

.main-container {
    margin-right: auto;
    margin-left: auto;
    max-width: 1200px;
}

.col-md-9 {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-heading {
    text-align: center;
    margin-bottom: 20px;
}

.board {
    width: 100%;
}

.board.disabled {
    pointer-events: none;
}

.bg-classic {
    background-color: #6c7d7d;
}
.btn-outline-classic {
    color: #6c7d7d;
    border-color: #6c7d7d;
}
.btn-outline-classic:hover {
    color: #fff;
    background-color: #6c7d7d;
}
.bg-bullet {
    background-color: #202020;
}
.btn-outline-bullet {
    color: #202020;
    border-color: #202020;
}
.btn-outline-bullet:hover {
    color: #fff;
    background-color: #202020;
}

.bg-tactics {
    background-color: #ff5722;
}
.btn-outline-tactics {
    color: #ff5722;
    border-color: #ff5722;
}
.btn-outline-tactics:hover {
    color: #fff;
    background-color: #ff5722;
}
.bg-motifs {
    background-color: #63b063;
}
.btn-outline-motifs {
    color: #63b063;
    border-color: #63b063;
}
.btn-outline-motifs:hover {
    color: #fff;
    background-color: #63b063;
}
.bg-mates {
    background-color: #7e57c2;
}
.btn-outline-mates {
    color: #7e57c2;
    border-color: #7e57c2;
}
.btn-outline-mates:hover {
    color: #fff;
    background-color: #7e57c2;
}
.bg-maneuvers {
    background-color: #708090;
}
.btn-outline-maneuvers {
    color: #708090;
    border-color: #708090;
}
.btn-outline-maneuvers:hover {
    color: #fff;
    background-color: #708090;
}

.bg-phases {
    background-color: #3b5998;
}
.btn-outline-phases {
    color: #3b5998;
    border-color: #3b5998;
}
.btn-outline-phases:hover {
    color: #fff;
    background-color: #3b5998;
}
.bg-opening {
    background-color: #6399b0;
}
.btn-outline-opening {
    color: #6399b0;
    border-color: #6399b0;
}
.btn-outline-opening:hover {
    color: #fff;
    background-color: #6399b0;
}
.bg-middlegame {
    background-color: #63b063;
}
.btn-outline-middlegame {
    color: #63b063;
    border-color: #63b063;
}
.btn-outline-middlegame:hover {
    color: #fff;
    background-color: #63b063;
}
.bg-endgame {
    background-color: #6363b0;
}
.btn-outline-endgame {
    color: #6363b0;
    border-color: #6363b0;
}
.btn-outline-endgame:hover {
    color: #fff;
    background-color: #6363b0;
}

/* Square styling */
.white-1e1d7 {
    background-color: #dee3e6;
}
.black-3c85d {
    background-color: #8ca2ad;
}
.white-1e1d7 .notation-322f9 {
    color: #8ca2ad;
}
.black-3c85d .notation-322f9 {
    color: #dee3e6;
}
/*
.white-1e1d7 {
    background-color: var(--bs-light-bg-subtle);
}
.white-1e1d7 .notation-322f9 {
    color: var(--bs-tertiary-color);
}
.black-3c85d {
    background-color: var(--bs-dark-bg-subtle);
}
.black-3c85d .notation-322f9 {
    color: var(--bs-tertiary-color);
}
*/

.material {
    margin-left: -1px;
}

/* Highlight colors */
.highlight1-32417, .highlight2-9c5d2 {
    box-shadow: inset 0 0 10px 3px rgba(100, 100, 100, 0.75);
}

.last-move-from {
    background-color: #8ac;
}
.last-move-to {
    background-color: #8ce;
}
.castling-from {
    background-color: #5b7 !important;
}
.castling-to {
    background-color: #395 !important;
}
/*
.capture-from {
    background-color: #fa5 !important;
}
.capture-to {
    background-color: #f90 !important;
}
*/
.promotion-from {
    background-color: #c666c6 !important;
}
.promotion-to {
    background-color: #822282 !important;
}


.premove-from {
    background-color: #bdf !important;
}
.premove-to {
    background-color: #bff !important;
}

.check {
    background-color: #fc0 !important;
}
.checkmate {
    background-color: #d00 !important;
}
.winner {
    background-color: goldenrod !important;
}
.draw {
    background-color: #666 !important;
}

/*
.hint-mistake {
    background-color: #f99 !important;
}
*/
.hint-good-from {
    background-color: #8b8 !important;
}
.hint-good-to {
    background-color: #6c6 !important;
}
.hint {
    background-color: #7e7 !important;
}
.hint-from {
    background-color: #4c4 !important;
}
.hint-to {
    background-color: #7e7 !important;
}

.book-move-from {
    background-color: #69b !important;
}
.book-move-to {
    background-color: #59c !important;
}
.brilliant-move-from {
    background-color: #5be !important;
}
.brilliant-move-to {
    background-color: #0df !important;
}
.great-move-from {
    background-color: #47a !important;
}
.great-move-to {
    background-color: #48c !important;
}
.best-move-from {
    background-color: #797 !important;
}
.best-move-to {
    background-color: #595 !important;
}
.best-move-to-fg {
    color: #595 !important;
}
.excellent-move-from {
    background-color: #898 !important;
}
.excellent-move-to {
    background-color: #696 !important;
}
.good-move-from {
    background-color: #9a9 !important;
}
.good-move-to {
    background-color: #7a7 !important;
}
.good-move-to-fg {
    color: #7a7 !important;
}
.inaccuracy-move-from {
    background-color: #c84 !important;
}
.inaccuracy-move-to {
    background-color: #fa5 !important;
}
.inaccuracy-move-to-fg {
    color: #fa5 !important;
}
.mistake-move-from {
    background-color: #d87 !important;
}
.mistake-move-to {
    background-color: #f76 !important;
}
.mistake-move-to-fg {
    color: #f76 !important;
}
.blunder-move-from {
    background-color: #c66 !important;
}
.blunder-move-to {
    background-color: #f44 !important;
}
.blunder-move-to-fg {
    color: #f44 !important;
}
.miss-move-from {
    background-color: #555 !important;
}
.miss-move-to {
    background-color: #444 !important;
}

/* Right click highlight */
.right-click-highlight {
    background-color: #f84 !important;
}

.top-badge {
    position: absolute;
    top: 0;
    left: 0;
    /*
    transform: translateX(+200%) translateY(-25%);
    */
    transform: translateX(-25%) translateY(-25%);
    z-index: 10;
}

/* Make content horizontally scrollable and limit to one line */
.one-line-scroll {
    white-space: nowrap;
    overflow-y: hidden;
    overflow-x: auto;
}
.one-line-scroll::-webkit-scrollbar {
    display: none;
}

/* Sidebar styling */

.sidebar {
    padding: 15px;
    border-left: 1px solid #ddd;
    height: 100%; /* Ensure the sidebar takes up full height */
    position: sticky;
    top: 0;
}

.sidebar h3 {
    margin-top: 0;
}

.sidebar button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar button i {
    margin: 8px; /* Space between icon and text */
}

.bot-image {
    width: 150px;
    height: 150px;
    display: block;
    margin: auto;
}

@media (max-width: 576px) {
    .modal-content {
        padding: 10px;
    }

    .bot-image {
        width: 100px;
        height: 100px;
    }
}

/* Move list styling */
.movelist {
    width: 100%;
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: hidden; /* Disable horizontal scrolling */
    padding-left: 0;
    list-style-type: none;
    text-align: justify;
    margin-bottom: 10px;
}

.movelist::-webkit-scrollbar {
    display: none; /* Hide scrollbar */
}

.movelist li {
    margin-bottom: 5px;
}

/* Horizontal scrolling for mobile */
@media (max-width: 576px) {
    .movelist {
        overflow-x: auto; /* Enable horizontal scrolling on mobile */
        overflow-y: hidden; /* Disable vertical scrolling on mobile */
        white-space: nowrap; /* Prevent wrapping of items */
        height: 50px; /* Adjust height on mobile */
    }

    .movelist li {
        display: inline-block; /* Display list items horizontally */
        margin-right: 10px; /* Space between moves */
    }
}

/* Vertical scrolling for desktop */
@media (min-width: 576px) {
    .movelist {
        height: 100px; /* Adjust height on desktop */
    }
}

/* Promotion popup */
.promotion-popup {
    position: absolute;
    padding: 10px;
    color: var(--bs-body-color);
    background: color-mix(in srgb, var(--bs-body-bg) 75%, transparent);
    
    border: 1px solid var(--bs-body-emphasis);
    border-radius: 5px;
    z-index: 10;
    display: none;
}
.piece-icon {
    cursor: pointer;
    margin: 5px;
    color: var(--bs-body-emphasis);
}
.piece-icon:hover {
    color: #007bff;
}

/* Engine/Bot styling */

.engine-avatar {
    position: relative;
}

.speech-bubble {
    position: absolute;
    top: 0px;
    left: 50px;
    width: 75%;
    transform: translateX(-25%) translateY(-50%);
    color: var(--bs-body-bg);
    background-color: var(--bs-body-color);
    border: 2px solid var(--bs-body-color);
    padding: 10px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 100;   
}

.speech-bubble:after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 75%;
    transform: translateX(-50%);
    border-width: 10px;
    border-style: solid;
    border-color: var(--bs-body-color) transparent transparent transparent;
}

.speech-bubble-mobile {
    position: absolute;
    left: 25%;
    color: var(--bs-body-bg);
    background-color: var(--bs-body-color);
    border: 2px solid var(--bs-body-color);
    padding: 10px;
    border-radius: 10px;
    font-size: 14px;
}

.speech-bubble-mobile:before {
    position: absolute;
    left: -5%;
    content: '';
    border-width: 10px;
    border-style: solid;
    border-color: var(--bs-body-color) transparent transparent transparent;
}

/* Colors */

.bg-dynamic {
    background-color: var(--bs-body-color) !important;
    color: var(--bs-body-bg) !important;
}

.btn-outline-body {
    color: var(--bs-emphasis-color);
    border-color: var(--bs-emphasis-color);
}

.btn-outline-body:hover {
    color: var(--bs-body-bg);
    background-color: var(--bs-emphasis-color);
}

.hidden {
    display: none;
}

.fab-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    position: absolute;
    bottom: 30px; right: 30px;
    &:hover {
        height: 100%;
        .sub-button:nth-child(2) {
            transform: translateX(-75px) translateY(-50px);
            visibility: visible;
        }
        .sub-button:nth-child(3) {
            transform: translateY(-140px);
        }
        .sub-button:nth-child(4) {
            transform: translateY(-200px);
        }
        .sub-button:nth-child(5) {
            transform: translateY(-260px);
        }
        .sub-button:nth-child(6) {
            transform: translateY(-320px);
        }
    }
    .fab {
        height: 70px; width: 70px;
        border-radius: 50%;
        color: var(--bs-body-bg);
        background-color: var(--bs-body-color);
        z-index: 2;
        .fab-content {
        display: flex;
        align-items: center; justify-content: center;
        height: 100%; width: 100%;
        border-radius: 50%;
        }
    }
    .sub-button {
        visibility: hidden;
        position: absolute;
        display: flex;
        bottom: 0px; right: 0px;
        height: 300px; width: 250px;
        transition: all .3s ease;
    }
}

.board-wrapper {
    width: 100%;
}

/* Container for evaluation bar */
.progress-container {
    position: relative;
    margin-right: 5px;  /* Space between progress bar and content */
}

/* Vertical evaluation bar styling */
.progress-vertical {
    width: 30px;             /* Adjust width of the vertical bar */
    height: 100% !important;            /* Full height of the content */
    display: flex;
    align-items: flex-end;    /* Make progress bar fill from bottom to top */
    border-radius: 0.25rem;
}

/* Evaluation bar */
.progress-bar {
    width: 100%;
}

/* Fill animation */
@keyframes fill-drain {
    0% {
        background-color: var(--bs-body-bg);
        color: var(--bs-emphasis-color);
        border-color: var(--bs-emphasis-color);
        width: 0;
    }
    100% {
        background-color: var(--bs-emphasis-color);
        color: var(--bs-body-bg);
        border-color: var(--bs-emphasis-color);
        width: 100%;
    }
}

/* Button animation class */
.btn-animated {
    position: relative;
    overflow: hidden;
    transition: color 0.4s ease; /* Text color transition */
}

/* Element for animated fill */
.btn-animated .fill-drain {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--bs-emphasis-color);
    color: var(--bs-body-bg) !important;
    border-color: var(--bs-emphasis-color);
    z-index: 0;
    animation: fill-drain 4s linear forwards; /* Adjust timing here */
}

/* Ensure button text stays above the fill */
.btn-animated span {
    position: relative;
    color: var(--bs-body-bg) !important;
    z-index: 1;
}

/* Spinner styling */
.spinner-border {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

.confetti {
    left: 0;
    pointer-events: none ;
    position: fixed;
    top: 0;
    transform: translate3d(0, 0, 0);
    will-change: transform;
    height: 100%;
    width: 100%;
}
.confetti-item {
    position: absolute;
    transform: translate3d(0, 0, 0);
    will-change: transform;
}
@keyframes confetti-fall {
    0% {
        transform: translateY(-100%)
    }
    95%{
        animation-timing-function: ease-in-out;
        transform: translateY(calc(100vh - 55%))
    }
    100% {
        transform: translateY(calc(150vh - 65%))
    }
}

@keyframes pop-and-fade {
    0% {
        opacity: 0;
        transform: scale(1) translate(-25%, -25%);
        visibility: visible;
    }
    50% {
        opacity: 1;
        transform: scale(1.5) translate(-25%, -25%);
        visibility: visible;
    }
    100% {
        opacity: 1;
        transform: scale(1) translate(-25%, -25%);
        visibility: visible;
    }
}

.pop-and-fade {
    visibility: hidden;
    animation: pop-and-fade 0.6s ease-out forwards;
}

@keyframes full-square-expand {
    0% {
        transform: scale(0);
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 1em;
        border-radius: var(--bs-border-radius-pill);
        width: 100%;
        height: 100%;
        visibility: visible;
    }
    25% {
        transform: scale(1);
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 1.5em;
        border-radius: 20%;
        visibility: visible;
    }
    50% {
        transform: scale(1);
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 2em;
        width: 100%;
        height: 100%;
        border-radius: 0%;
        visibility: visible;
    }
    75% {
        transform: scale(1);
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 2em;
        width: 100%;
        height: 100%;
        border-radius: 0%;
        visibility: visible;
    }
    100% {
        transform: scale(1) translate(-25%, -25%);
        font-size: 0.75em;
        width: auto;
        height: auto;
        border-radius: var(--bs-border-radius-pill);
        visibility: visible;
    }
  }
  
.full-square-expand {
    visibility: hidden;
    animation: full-square-expand 0.6s ease-out forwards;
    display: inline-block;
}

/* Game Over Modal Animation */
.animated-icon {
    display: inline-block;
    font-size: 48px;
    margin-bottom: 15px;
}

/* Animation Classes */
.bounce-icon {
    animation: bounceIcon 3s;
}

.spin-icon {
    animation: spinIcon 2s ease-in-out;
}

.pulse-icon {
    animation: pulseIcon 3s ease-in-out;
}

.swing-icon {
    animation: swingIcon 2s ease-in-out;
}

.rotate-icon {
    animation: rotateIcon 2s linear;
}

.fade-icon {
    animation: fadeIcon 2s linear;
}

.pop-icon {
    animation: popIcon 1.5s linear;
}

.shake-icon {
    animation: shakeIcon 1.5s cubic-bezier(.36,.07,.19,.97) both;
}

.fall-icon {
    animation: fallIcon 2s ease forwards;
}

/* Keyframes for animations */
@keyframes bounceIcon {
    0%, 10%, 30%, 50%, 70%, 90%, 100% {
        transform: translateY(0);
    }
    20% {
        transform: translateY(-20px);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-7px);
    }
    80% {
        transform: translateY(-10px);
    }
}

@keyframes spinIcon {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(180deg);
    }
    50% {
        transform: rotate(360deg);
    }
    75% {
        transform: rotate(540deg);
    }
    100% {
        transform: rotate(720deg);
    }
}

@keyframes pulseIcon {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(1.2);
    }
    75% {
        transform: scale(1.1);
    }
}

@keyframes swingIcon {
    0% {
        transform: rotate(0deg);
    }
    10% {
        transform: rotate(30deg);
    }
    20% {
        transform: rotate(-30deg);
    }
    30% {
        transform: rotate(15deg);
    }
    40% {
        transform: rotate(-15deg);
    }
    50% {
        transform: rotate(10deg);
    }
    60% {
        transform: rotate(-10deg);
    }
    70% {
        transform: rotate(5deg);
    }
    80% {
        transform: rotate(-5deg);
    }
    90% {
        transform: rotate(2deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

@keyframes rotateIcon {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(90deg);
    }
    50% {
        transform: rotate(180deg);
    }
    75% {
        transform: rotate(270deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIcon {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    25% {
        opacity: 0.25;
        transform: scale(0.75);
    }
    50% {
        opacity: 0.5;
        transform: scale(1);
    }
    75% {
        opacity: 0.75;
        transform: scale(1.25);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes popIcon {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    30% {
        transform: scale(0.7);
        opacity: 0.4;
    }
    60% {
        transform: scale(1);
        opacity: 0.8;
    }
    80% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes shakeIcon {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 80% {
        transform: translateX(-4px);
    }
    40%, 60% {
        transform: translateX(4px);
    }
    50% {
        transform: translateX(-2px);
    }
}

@keyframes fallIcon {
    0% {
        transform: rotate(0deg) translateY(0);
        color: var(--bs-emphasis-color);
    }
    25% {
        transform: rotate(5deg) translateY(2px);
        color: var(--bs-emphasis-color);
    }
    50% {
        transform: rotate(10deg) translateY(4px);
    }
    75% {
        transform: rotate(15deg) translateY(7px);
    }
    100% {
        transform: rotate(90deg) translateY(-10px) translateX(10px);
        color: var(--bs-danger);
        opacity: 0.7;
    }
}

#gameAnalysisModal .modal-content {
    animation: zoomInDraw 1s ease forwards;
    border-bottom: 5px solid var(--bs-emphasis-color);
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.1);
}
#gameAnalysisModal .modal-header {
    background-color: var(--bs-emphasis-color);
    color: var(--bs-body-bg);
}

/* Animation for Modal Result Based on Outcome */
.game-over-win .modal-content {
    animation: zoomInDraw 1s ease forwards;
    border: 0px;
    padding: 0px;
    border-bottom: 5px solid var(--bs-success);
    box-shadow: 0 0 100px rgba(0, 100, 0, 0.2);
}
.game-over-win .modal-header {
    background-color: var(--bs-success);
    color: var(--bs-light);
}

.game-over-loss .modal-content {
    animation: zoomInDraw 1s ease forwards;
    border: 0px;
    padding: 0px;
    border-bottom: 5px solid var(--bs-danger);
    box-shadow: 0 0 100px rgba(100, 0, 0, 0.2);
}
.game-over-loss .modal-header {
    background-color: var(--bs-danger);
    color: var(--bs-light);
}

.game-over-draw .modal-content {
    animation: zoomInDraw 1s ease forwards;
    border: 0px;
    padding: 0px;
    border-bottom: 5px solid var(--bs-secondary);
    box-shadow: 0 0 100px rgba(100, 100, 100, 0.2);
}
.game-over-draw .modal-header {
    background-color: var(--bs-secondary);
    color: var(--bs-light);
}

@keyframes bounceInWin {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-15px);
    }
    60% {
        transform: translateY(-7px);
    }
}

@keyframes shakeLoss {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

@keyframes zoomInDraw {
    from {
        transform: scale(0.3);
    }
    to {
        transform: scale(1);
    }
}

/* General Modal Styles */
.level-up-modal .modal-content {
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Subtle Heading */
.level-up-heading {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ffcc00;
    text-shadow: 0 2px 5px rgba(255, 204, 0, 0.3);
}

/* Icon Animation */
.animated-icon.level-up-icon {
    font-size: 4rem;
    color: #ffcc00;
    animation: combinedIconAnimation 2s infinite ease-in-out;
}

/* Combined Icon Animation */
@keyframes combinedIconAnimation {
    0%, 100% {
        transform: translateY(0);
        filter: drop-shadow(0 0 10px #ffcc00);
    }
    25% {
        transform: translateY(-20px);
        filter: drop-shadow(0 0 15px #ffd700);
    }
    50% {
        transform: translateY(0);
        filter: drop-shadow(0 0 10px #ffcc00);
    }
    75% {
        transform: translateY(-10px);
        filter: drop-shadow(0 0 12px #ffd700);
    }
}