body {
    display: flex;
    flex-direction: row;
    background: #2c2c2c;
    color: #f5f5f5;
    font-family: 'Roboto', sans-serif;
    margin: 0;
    /* margin-left: 20%; */
    padding: 0;
    /* height: 100vh; */
    margin-top:20px;
    align-items: flex-start;
    /* justify-content: center; */
    overflow-y: auto;
    margin-left:20px;
}

.container {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;

    margin-right: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-height: 100%;
    overflow: visible;
}

.canvas-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.controls {
    display: flex;
    flex-direction: column;
}

.section {
    margin-bottom: 20px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: box-shadow 0.3s, border 0.5s;
    overflow: hidden;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    flex-grow: 1;
    display: block;
}

.section:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-image: linear-gradient(90deg, #9945FF, #14F195) 1;
    border-image-width: 2px;
    border-radius: 8px;
}

.section-title {
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 10px;
    padding-left: 15px;
}



.grid-container {
    overflow: hidden;
    /* width: calc(10 * 103px); */
    width:100%;
    position: relative;
}

.grid {
    display: flex;
    transition: transform 0.3s ease-in-out;
}

.scroll-container {
    display: flex;
    align-items: center;
    position: relative;
}
.scroll-left,
.scroll-right {
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 5px;
    z-index: 10;
    position: absolute;
}

.scroll-left {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.scroll-right {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.thumbnail {
    width: 100px;
    height: 100px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 5px;
    transition: border-color 0.3s, transform 0.3s;
    box-sizing: border-box;
}

.thumbnail.selected {
    border-image: linear-gradient(360deg, #9945FF, #14F195) 1;
}

.thumbnail:hover {
    border-color: #14F195;
    /* transform: scale(1.05); */
    border-image: linear-gradient(360deg, #9945FF, #14F195) 1;
    animation: border-animation 5s linear infinite;
}

#avatarCanvas {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

button {
    background: #000;
    color: #14F195;
    border: 2px solid #14F195;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s, color 0.3s;
    align-self: center;
    margin-top: 10px;
    font-size: 14px;
}

button:hover {
    background: #14F195;
    color: #000;
}

.instructions {
    margin-top: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    box-sizing: border-box;
}

.instructions h2 {
    margin: 0 0 10px 0;
}

.instructions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.instructions ul li {
    margin-bottom: 5px;
}

.footer {
    text-align: center;
    color: #f5f5f5;
    margin-top: 20px;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
}

.footer a {
    color: #14F195;
    text-decoration: none;
    transition: color 0.3s;
}

.footer a:hover {
    color: #9945FF;
}

.button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
    gap: 5px; /* Adjust the gap between buttons as needed */
}

.button-container-horizontal {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px; /* Adjust the gap between buttons as needed */
    margin-top: 10px;
}

.icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px; /* Adjust the gap between the icon and text as needed */
    padding: 10px;
    width: 120px; /* Set a fixed width for all buttons */
    height: 40px; /* Set a fixed height for all buttons */
    background-color: #14F195; /* Normal button background color */
    color: rgb(0, 0, 0); /* Normal button text color */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition for hover effects */
    white-space: nowrap; /* Prevent text wrapping */
}

.icon-button img {
    width: 24px; /* Icon size */
    height: 24px;
}

.icon-button:hover {
    background-color: rgb(16, 16, 16); /* Hover button background color */
    color: #ffffff; /* Hover button text color */
}

.icon-button:hover img {
    filter: invert(56%) sepia(32%) saturate(611%) hue-rotate(108deg) brightness(98%) contrast(92%);
}

.drawer {
    position: fixed;
    right: 0;
    top: 20px;
    width: 70%;
    height: 100%;
    background: rgba(44, 44, 44, 0.95);
    box-shadow: -4px 0 8px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 1000;
}

.drawer.open {
    transform: translateX(0);
}

.icon-button-drawer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
}

.icon-button-close {
    position: absolute;
    top: -10px;
    left: -1px;
    width: 15px;
    height: 15px;
    background: none;
    /* border: none; */
    padding: 10px;
    cursor: pointer;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001; /* Ensure it appears above the drawer content */
}


#avatarCanvas {
    max-width: 100%;
    height: auto;
}

@media (max-width: 2500px){
    .drawer {
        width: 78%;
    }
}
@media (max-width: 2100px){
    .drawer {
        width: 73%;
    }
}
@media (max-width: 1800px){
    .drawer {
        width: 69%;
    }
}
@media (max-width: 1620px){
    .drawer {
        width: 65%;
    }
}
@media (max-width: 1300px){
    .drawer {
        width:62%;
    }
}
@media (max-width: 1050px){
    .drawer { 
        width:52%;
    }
}
@media (max-width: 950px){
    .drawer {
        width:42%;
    }
}
@media (max-width: 768px) {
    body {
        flex-direction: column !important;
        margin-right: 0;
        width: 100%; /* Ensure the body does not overflow */
        height:100%;
        box-sizing: border-box;
        margin-left:0;
    }

    .container {
        flex-direction: column;
        margin-right: 0;
        max-width: 100%; /* Ensure the container does not overflow */
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 15px;
    }
    #avatarCanvas {
        max-width: 100%;
        height: auto;
    }
    .canvas-container{
        box-sizing: border-box;
        width:100%;
    }
    .canvas-info {
        margin-right: 0;
        max-width: 100%; /* Ensure the container does not overflow */
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 15px;
    }

    .instructions {
        margin-top: 10px;
    }

    .thumbnail {
        width: 80px;
        height: 80px;
    }
    .controls {
        width: 100%; /* Ensure it stretches to full width */
        box-sizing: border-box;
    }
    
    .grid-container {
        width: 100%; /* Ensure it stretches to full width */
        box-sizing: border-box;
    }
    
    .grid {
        width: 100%; /* Ensure it stretches to full width */
        box-sizing: border-box;
    }
    
    .scroll-container {
        width: 100%; /* Ensure it stretches to full width */
        box-sizing: border-box;
    }
    .drawer {
        position: fixed;
        right: 0;
        top: 0;
        width: 95%;
        height: 100%;
        background: rgba(44, 44, 44, 0.95);
        box-shadow: -4px 0 8px rgba(0, 0, 0, 0.2);
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        z-index: 1000;
    }
    .drawer.open {
        transform: translateX(0);
    }
    
    .icon-button-drawer {
        position: fixed;
        top: 0;
        right: 20px;
        z-index: 1100;
    }
}

@media (max-width: 480px) {
    body {
        flex-direction: column !important;
        margin-right: 0;
        width: 100%; /* Ensure the body does not overflow */
        height:100%;
        box-sizing: border-box;
        margin-left:0;
    }

    .container {
        flex-direction: column;
        margin-right: 0;
        max-width: 100%; /* Ensure the container does not overflow */
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 15px;

    }
    .canvas-container{
        box-sizing: border-box;
        width:100%;
    }

    .icon-button {
        width: 100%;
        max-width: 100%;
    }

    .scroll-left, .scroll-right {
        padding: 5px;
    }

    .thumbnail {
        width: 60px;
        height: 60px;
    }

    .instructions {
        font-size: 14px;
    }

    .footer {
        font-size: 12px;
    }
    .controls {
        width: 100%; /* Ensure it stretches to full width */
        box-sizing: border-box;
    }
    
    .grid-container {
        width: 100%; /* Ensure it stretches to full width */
        box-sizing: border-box;
    }
    
    .grid {
        width: 100%; /* Ensure it stretches to full width */
        box-sizing: border-box;
    }
    
    .scroll-container {
        width: 100%; /* Ensure it stretches to full width */
        box-sizing: border-box;
    }
    .canvas-container{
        box-sizing: border-box;
        width:100%;
    }
    .canvas-info {
        margin-right: 0;
        max-width: 100%; /* Ensure the container does not overflow */
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 15px;
    }
    .drawer {
        position: fixed;
        right: 0;
        top: 0;
        width: 90%;
        height: 100%;
        background: rgba(44, 44, 44, 0.95);
        box-shadow: -4px 0 8px rgba(0, 0, 0, 0.2);
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        z-index: 1000;
    }
    .drawer.open {
        transform: translateX(0);
    }
    
    .icon-button-drawer {
        position: fixed;
        top: 0;
        right: 50%;
        z-index: 1100;
    }
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    body {
        flex-direction: column;
        margin: 0;
        padding: 0;
        overflow-x: hidden; /* Prevent horizontal scroll */
    }
    .container {
        flex-direction: column;
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
    }
    .canvas-container {
        width: 100%;
        max-width: 100%;
        margin-bottom: 20px;
    }
    #avatarCanvas {
        width: 100%; /* Make canvas full-width on mobile */
        height: auto; /* Maintain aspect ratio */
        max-height: 50vh; /* Limit height to half viewport for usability */
    }
    .thumbnail {
        width: 60px; /* Larger for touch */
        height: 60px;
        margin: 10px; /* More spacing */
    }
    .button-container, .button-container-horizontal {
        flex-direction: row;
        justify-content: center;
        gap: 10px;
    }
    button {
        padding: 12px 20px; /* Larger tap areas */
        font-size: 16px;
    }
    .drawer {
        width: 100% !important; /* Full-width on mobile */
        height: auto;
        max-height: 60vh;
        overflow-y: auto; /* Scrollable if content overflows */
    }
    .grid-container {
        overflow-x: auto; /* Horizontal scroll for thumbnails */
        white-space: nowrap;
    }
    .grid {
        display: inline-flex; /* Allow horizontal scrolling */
    }
    .instructions {
        font-size: 14px;
    }
}

/* Prevent zoom on double-tap (optional, if unwanted) */
html {
    touch-action: manipulation;
}
#avatarCanvas {
    touch-action: none; /* Disable browser gestures on canvas */
}

#avatarCanvas {
    touch-action: none; /* Prevent pinch-to-zoom, scrolling */
    user-select: none; /* Prevent text selection */
}

/* Highlight selected entity for touch */
.thumbnail.selected {
    border: 2px solid #9945FF;
    opacity: 0.8;
}


