:root {
    --main-bg: #000;
    --main-blue: #00aeef;
    --main-mauve: #ec008c;
    --white: #fff;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --light: #f8f9fa;
}

.puzzle-page {
    background-color: var(--main-bg);
    background-image: url("/imgs/body-bg.png");
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 20px 20px;
}

#puzzleBoard {
    direction: ltr !important;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px auto;
}

.puzzle-container {
    text-align: center;
    padding: 40px;
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    background-color: var(--glass-bg);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    grid-column: 2;
    justify-self: center;
    margin: 0 !important;
    width: 95%;
    max-width: 450px;
    /* margin: 20px auto; */
    position: relative;
    direction: inherit;
    z-index: 1;
}

.puzzle-container h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(to right, var(--main-blue), var(--main-mauve));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 25px;
}

/* Scores */
.scores {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.score-box label {
    font-size: 12px;
    text-transform: uppercase;
    color: #aaa;
    margin-bottom: 5px;
    display: block;
}

.score-box strong {
    font-size: 20px;
    color: var(--white);
}

/* Board & Squares */
.board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 25px;
}

.square {
    aspect-ratio: 1/1;
    border-radius: 16px;
    font-size: 28px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.square img {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    object-fit: cover;
}

.square:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 15px var(--main-blue);
}

/* Buttons */
.mode-select {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 25px;
}

.puzzle-container button {
    padding: 12px 20px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
}

.puzzle-container button:hover {
    background: var(--main-blue);
    border-color: var(--main-blue);
    box-shadow: 0 10px 20px rgba(0, 174, 239, 0.3);
}

.puzzle-container button.active {
    background: var(--main-mauve);
    border-color: var(--main-mauve);
}

.status p {
    font-weight: 500;
    color: var(--light);
    margin-bottom: 10px;
}

/* Win animation */
.square.correct {
    background: var(--main-blue);
    color: white;
    box-shadow: 0 0 25px var(--main-blue);
    animation: pulse 0.8s infinite alternate;
}

@keyframes pulse {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.05);
    }
}
.square.empty {
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    cursor: grab;
}
.square.dragging {
    opacity: 0.7;
    transform: scale(1.05);
    z-index: 10;
}
.square.empty {
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed rgba(255, 255, 255, 0.25);
}

.square.selected {
    border: 2px solid var(--main-blue);
    box-shadow: 0 0 20px var(--main-blue);
    transform: scale(1.05);
}
.square[draggable="true"] {
    cursor: grab;
}

.square[draggable="true"]:active {
    cursor: grabbing;
}
.square.dragging {
    opacity: 0.4;
    transform: scale(0.9);
    border: 2px dashed var(--main-blue);
}

.square.empty {
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(0, 174, 239, 0.4);
    transition: all 0.3s ease;
}

.square.empty:hover {
    background: rgba(0, 174, 239, 0.1);
    border-color: var(--main-blue);
}
.game-page-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    align-items: start;
    gap: 30px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 120px 20px 40px;
    box-sizing: border-box;
}

@media (min-width: 1200px) {
    .game-page-wrapper {
        grid-template-columns: 300px 1fr 300px;
    }
}

@media (max-width: 1199px) and (min-width: 768px) {
    .game-page-wrapper {
        grid-template-columns: 1fr 300px;
    }
    .puzzle-container {
        grid-column: 1;
    }
    .games-sidebar {
        grid-column: 2;
    }
}

@media (max-width: 767px) {
    .game-page-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 100px 15px 20px;
    }
    .puzzle-container, .games-sidebar {
        grid-column: auto;
        width: 100%;
        max-width: 100%;
    }
    .games-sidebar {
        position: static;
        margin-top: 30px;
    }
}

