/* Keep existing styles */
body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    background-color: #f0f0f0;
    flex-direction: column;
}

h2 {
    text-align: center;
}

#maze-wrapper {
    position: relative;
    width: 60vmin;
    height: 60vmin;
    display: block;
    justify-content: center;
    align-items: center;
    padding-top: calc((60vmin * (1.414 - 1)) / 2);
}

#maze-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* Adjust based on grid size */
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
    transform: rotate(45deg);
}

.room {
    position: relative;
    width: 100%;
    height: 100%;
    border: 2px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: white;
    box-sizing: border-box;
}

.room-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    transform: rotate(-45deg); /* To ensure text is readable */
    color: red;
}

.portal {
    position: absolute;
    width: 25px;
    height: 25px;
    background-color: #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
    border-radius: 50%;
    transform: rotate(-45deg);
}

.portal.up {
    top: 5px;
    left: 50%;
    transform: translate(-50%, 0) rotate(-45deg);
}

.portal.right {
    right: 5px;
    top: 50%;
    transform: translate(0, -50%) rotate(-45deg);
}

.portal.down {
    bottom: 5px;
    left: 50%;
    transform: translate(-50%, 0) rotate(-45deg);
}

.portal.left {
    left: 5px;
    top: 50%;
    transform: translate(0, -50%) rotate(-45deg);
}

.portal:hover {
    background-color: #ffeb3b;
    transform: scale(1.2) rotate(-45deg);
}

.room.highlight {
    background-color: #ffeb3b;
}

.path-highlight {
    background-color: #4caf50; /* Green color for highlighted path */
    color: #fff; /* White text for numbering */
}

.selected {
    border-color: #ffeb3b; /* Highlight the selected rooms */
}

.highlight {
    border-color: #ffeb3b; /* Highlight the target room on mouseover */
}



/* Responsive design for smaller screens */
@media (max-width: 980px) {

    #maze-container {
        gap: 2px; /* Reduce gap between rooms */
    }

    .room {
        border-width: 1px; /* Thinner borders */
    }

    .portal {
        width: 18px; /* Smaller portals */
        height: 18px;
    }

    .portal.up {
        top: 2px; /* Adjusted for smaller size */
        font-size: 0;
    }

    .portal.right {
        right: 2px;
        font-size: 0;
    }

    .portal.down {
        bottom: 2px;
        font-size: 0;
    }

    .portal.left {
        left: 2px;
        font-size: 0;
    }

    .path-highlight {
        font-size: 14px !important;
    }

    .room-text {
        font-size: 9px;
    }
}

@media (max-width: 768px) {

    #maze-container {
        gap: 1px; /* Further reduce gap between rooms */
    }

    .room {
        border-width: 1px; /* Thinner borders */
    }

    .portal {
        width: 10px; /* Smaller portals */
        height: 10px;
    }

    .portal.up {
        top: 1px; /* Adjusted for smaller size */
    }

    .portal.right {
        right: 1px;
    }

    .portal.down {
        bottom: 1px;
    }

    .portal.left {
        left: 1px;
    }

    .path-highlight {
        font-size: 12px !important;
    }

    .room-text {
        font-size: 7px;
    }
}