/* styles.css */
body {
  overscroll-behavior-y: none; /* После этого свайп вниз не будет вызывать обновление страницы */
}
.chess-body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    height: 94vh;
    /*align-items: center;
    height: 94vh;
    background-color: #f0f0f0;*/
}

/*.container {
    display: flex;
    flex-direction: row;
    padding: 8px;
    max-width: 900px;
    width: 100%;
}*/

.chess-container {
    /*display: flex;
    flex-direction: row;*/
    justify-content: center;
    /*padding: 8px;
    max-width: 1200px;*/
    max-width: 100%;
    width: 100%;
}

@media (max-width: 700px) {
    .chess-container {
        max-width: 1200px;
    }
}

@media (max-width: 950px) and (orientation: landscape) {
    .chess-container {
        max-width: 100%;
        display: flex;
        justify-content: flex-start;
    }

}

@media (max-width: 1200px) and (orientation: portrait) {
    .chess-container {
        max-width: 100%;
        display: flex;
        justify-content: flex-start;
    }
}

@media (max-width: 1200px) and (max-height: 800px) and (orientation: landscape) {
    .chess-container {
        max-width: 100%;
        display: flex;
        justify-content: flex-start;
    }
}

.sidebar {
    flex: 1;
    /*max-width: 230px;
    margin: 0 8px;*/
    margin-top: 4px;
    padding: 8px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
}
.sidebar-wide {
    flex: 1;
    min-width: 330px;
    background-color: #fff;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
    margin: 0 8px;
}

.sidebar h3 {
    margin-bottom: 8px;
    font-size: 14px;
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    flex-grow: 1; /* Allow the <ul> to take up the remaining space in the sidebar */
    overflow-y: auto; /* Add vertical scrollbar if content overflows */
}

.sidebar ul li {
    padding: 6px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    font-size: 12px;
}

.sidebar ul li:hover {
    background-color: #f9f9f9;
}

.sidebar ul li.selected {
    background-color: #f0f0f0; /* Light background for highlighting */
}

.checkmark {
    display: none; /* Hidden by default */
}

.main-content {
    background-color: #fff;
    padding: 50px 20px 0px 20px;
    height: calc(100vh - 65px);
    /*border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
    flex: 2;
    display: flex;
    flex-direction: column;*/
}
.course_item_main .main-content {
    background-color: #191E3B;
}
@media (max-width: 700px) {
    .main-content {
        padding: 5px 5px 0px 5px;
        height: 100vw;
    }
}

.main-content {
    margin: 0 auto;
}

#board {
    width: 80vh;
    /*height: 450px;*/ /* Commented out as per original code */
    margin: 0 auto;
    /* Added CSS properties */
    user-select: none; /* Prevents text selection */
    -webkit-user-drag: none; /* Prevents element dragging in WebKit browsers */
    pointer-events: auto; /* Ensures the element can still respond to pointer events */
}

@media (max-width: 700px) and (orientation: landscape) {
    .main-content #board {
        width: 82vh;
    }
    .main-content {
        height: 87vh;
    }
}

@media (max-width: 950px) and (orientation: landscape) {
    .main-content #board {
        width: 82vh;
    }
    .main-content {
        height: 87vh;
        padding: 5px 5px 0px 5px;
    }
}

@media (max-width: 1199px) and (orientation: portrait) {
    .main-content #board {
        width: 100%;
    }
    .main-content {
        height: 100vw;
        padding: 5px 5px 0px 5px;
        flex: none;
        max-width: 100vw;
    }
}
@media (min-width: 1000px) and (max-width: 1199px) and (min-height: 1300px) and (orientation: portrait) {
    .main-content {
        flex: none;
        max-width: 100vw;
    }
}

}

@media (max-width: 1180px) and (orientation: landscape) {
    .main-content #board {
        width: calc(100vh - 100px);
    }
}

@media (max-width: 1200px) and (min-height: 700px) and (max-height: 800px) {
    .main-content #board {
        width: calc(100vh - 100px);
    }
    .main-content {
        height: calc(100vh - 45px);
        width: calc(100vh - 45px);
        padding: 5px 5px 0px 5px;
    }
}
@media (max-width: 1200px) and (min-height: 700px) and (max-height: 800px) and (orientation: portrait){
    .main-content #board {
        width: 100vw;
    }
    .main-content {
        height: 100vw;
        width: 100vw;
        padding: 5px 5px 0px 5px;
    }
}

.highlight-square {
    box-shadow: inset 0 0 3px 3px yellow;
}

.square-55d63 {
    position: relative; /* Make sure the square is positioned relative */
}

.square-55d63.highlight-corner::before,
.square-55d63.highlight-corner::after {
    content: '';
    position: absolute;
    border-style: solid;
}

.square-55d63.highlight-corner::before {
    border-width: 15px 15px 0 0; /* Top and right edges */
    border-color: rgba(25, 30, 59, 0.5) transparent transparent transparent; /* Color for the top-right triangle */
    top: 0;
    left: 0;
}

.square-55d63.highlight-corner::after {
    border-width: 0 0 15px 15px; /* Bottom and left edges */
    border-color: transparent transparent rgba(25, 30, 59, 0.5) transparent; /* Color for the bottom-left triangle */
    bottom: 0;
    right: 0;
}

.dot {
    position: absolute;
    width: 20px; /* Larger dot width */
    height: 20px; /* Larger dot height */
    background-color: rgba(25, 30, 59, 0.5); /* Transparent version of #191E3B */
    border-radius: 50%; /* Round shape for the dot */
    top: 50%; /* Position vertically in the center */
    left: 50%; /* Position horizontally in the center */
    transform: translate(-50%, -50%); /* Center the dot exactly */
}


#puzzle-solved-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: green;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

#puzzle-solved-effect.visible {
    opacity: 1;
    pointer-events: auto;
}

#errorMessage, #illegalMoveMessage {
    color: red;
    background-color: rgba(255, 0, 0, 0.1);
    padding: 10px; 
    border: 1px solid red;
    margin-top: 10px;
}

.success-message {
    color: green;
    font-weight: bold;
    font-size: 16px;
    margin-top: 5px;
    transition: opacity 0.3s ease-in-out;
}

#congratulations {
    margin-top: 4px;
    font-size: 24px;
    color: green;
}

#status {
    margin-top: 4px;
    font-size: 24px;
}

#pgn {
    margin-top: 4px;
    font-size: 12px; 
}

#error-message {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 5px;
    display: none;
    width: calc(100% - 40px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

#next-puzzle, #previous-puzzle {
    width: 150px;
    margin-top: 8px;
    padding: 6px 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

#next-puzzle:hover, #previous-puzzle:hover {
    background-color: #0056b3;
}


/* Promotion Modal Styles */
.puzzle-content {
    position: relative;
  }

#promotionOverlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
    pointer-events: all;
}

.promotion-choices {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.promotion-wrapper {
    border-radius: 50%;
    background-color: #b0b0b0;
    box-shadow: inset 0 0 10px gray;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    /* remove width and height from CSS, they come from JS now */
}

.promotion-wrapper:hover {
    background-color: #a0a0a0;
    transform: scale(1.1);
}

.promotion-choice {
    width: 80%;
    height: 80%;
    object-fit: contain;
    pointer-events: none;
}


#promotionModal {
    display: none;
    position: absolute;
    z-index: 1000;
}

.promotion-options {
    display: flex;
    justify-content: space-around;
    margin-top: 8px;
}

.piece {
    position: relative;
    z-index: 5;
}

.promotion-choice:hover {
    transform: scale(1.05);
}

#turn-display {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin-top: 20px;
}

.hidden {
    display: none;
}

.visible {
    display: block;
}

/* Move highlighting styles */
.pgn-move {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s, color 0.2s;
}

.pgn-move:hover {
    background-color: rgba(181, 136, 99, 0.3);
}

.current-move {
    background-color: #b58863 !important;
    color: #f0d9b5 !important;
    font-weight: 600;
}

.move-white.current-move,
.move-black.current-move {
    background-color: #b58863 !important;
    color: #f0d9b5 !important;
    font-weight: 600;
}

.move-white.current-move .pgn-move,
.move-black.current-move .pgn-move {
    color: #f0d9b5 !important;
}

.move-placeholder {
    color: #ccc;
    display: inline-block;
    padding: 3px 6px;
}
