* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Roboto', Arial, sans-serif;
    background: #862AAE;
    color: #fff;
    /* overflow: hidden; */ /* Removido para o Bulma gerenciar */
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* --- SELEÇÃO E DRAG DISABLED --- */
body, #canvasContainer, #sidebar, #right-sidebar {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    user-drag: none;
}
img {
    pointer-events: none;
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #862AAE;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}
#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}
.loader-content {
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}
.loader-title {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    /* margin-bottom: 3rem; */ /* Removed */
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}
.loader-title img {
    max-width: 300px;
}
#mouse-tracker {
    position: absolute;
    top: 70%;
    left: 50%;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.5s ease; /* Ensure this transition is here */
    pointer-events: none; /* Make sure it doesn't block other mouse events */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translate( -50%, -50% ); /* Centraliza o tracker no mouse */
}
#mouse-tracker.visible {
    opacity: 1;
}
.loader-bar {
    width: 100%; /* Reduced width */
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
    opacity: 0.1;
}
.loader-progress {
    height: 100%;
    background: linear-gradient(90deg, #E1AE81, #E1AE81);
    width: 0%;
    transition: width 0.3s ease;
}
.loader-text {
    font-size: 0.875rem;
    letter-spacing: 0.1em;
    color: #E1AE81;
    text-align: center;
    /* animation removed */
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* --- Layout --- */
main.columns {
    height: 100vh;
    width: 100vw;
}

#sidebar {
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center; /* Changed */
    position: sticky; /* Fixo na lateral */
    top: 0;
    height: 100vh;
}
.logo img {
    max-width: 294px; /* Ajuste para o logo desktop */
    height: auto;
}
#sidebar .logo img.is-hidden-tablet {
    max-width: 225px;
    display: none !important; /* Esconde logo mobile no desktop */
}
#sidebar .logo img.is-hidden-mobile {
    display: block !important; /* Mostra logo desktop no desktop */
}

#canvas-column {
    position: relative;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px; /* Padding para o wrap */
}

#canvas-wrap {
    background: #D16484;
    padding: 15px;
    border-radius: 20px;
    position: relative;
    top: 0;
    width: 100%;
    height: calc( 100vh - 100px );
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Canvas Container */
#canvasContainer {
    position: relative; /* Ajustado para ser relativo ao wrap */
    width: 100%;
    height: 100%;
    border-radius: 8px;
    cursor: grab;
    overflow: hidden;
    background: #862AAE;
    z-index: 5;
}
#canvasContainer.grabbing {
    cursor: grabbing;
}
#artCanvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    image-rendering: high-quality;
}

/* Controls */
.controls {
    background-color: rgba( 134, 42, 174, 0.7 );
    border: 6px solid #E1AE81;
    border-radius: 20px;
    position: absolute; /* Ajustado para ser absoluto ao wrap */
    right: -5px;
    bottom: 25px;
    display: block;
    padding: 0;
    opacity: 0;
    animation: slideUp 0.6s ease 1s forwards;
    z-index: 15;
    width: 58px;
    height: 110px;
    justify-content: center;
}
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}
.btn {
    color: #E1AE81;
    cursor: pointer;
    font-size: 30px;
    transition: all 0.3s ease;
    width: 100%;
    height: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    position: relative;
}
.btn:hover {
    transform: translateY(0);
}
.btn:active {
    transform: translateY(0);
}
.btn:first-child {
    border-bottom: solid 4px #E1AE81;
}
.btn:last-child {
    top: -3px;
}
.btn img {
    width: 21px;
}


#zoomInBtn {}
#zoomOutBtn {}

/* Zoom Info */
.zoom-info {
    display: none;
    position: absolute; /* Ajustado para ser absoluto ao wrap */
    bottom: 2rem;
    right: 2rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.1em;
    opacity: 0;
    z-index: 10;
    animation: fadeIn 0.6s ease 1s forwards;
}

.download-btn {
    position: absolute;
    top: 50px;
    right: 50px;
    z-index: 99;
}

/* Right Sidebar */
#right-sidebar {
    padding: 2rem;
    display: flex;
    flex-direction: column; /* Changed */
    justify-content: space-between; /* Changed */
    align-items: center;
    position: sticky;
    top: 0;
    height: 100vh;
}
#right-sidebar .sidebar-content {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}
#right-sidebar .sidebar-content img {
    max-width: 66px;
    height: auto;
}
#creditsLink {
    font-size: 10px;
    color: #000;
    opacity: 0.3;
    text-decoration: none;
    transition: opacity 0.3s ease;
    padding-bottom: 10px;
    letter-spacing: 1px;
    position: fixed;
    bottom: 5vh;
    right: 3vw;
    z-index: 99;
}
    #creditsLink:hover {
        color: #FFF;
        opacity: 1;
    }
        #creditsLink em {

        }
        #creditsLink:hover {
            opacity: 1;
            color: #fff;
        }

/* --- Responsivo --- */
@media (max-width: 768px) {
    main.columns {
        flex-direction: column;
        overflow: auto; /* Permite scroll no mobile */
    }
    .download-btn {
        top: 70px;
        right: 30px;
    }
    .download-btn img {
        width: 20px;
    }
    #sidebar {
        position: relative; /* Deixa de ser fixo no mobile */
        width: 100%;
        height: auto;
        padding: 1rem;
        z-index: 20;
        align-items: center;
        flex-direction: row; /* Alinha o logo horizontalmente */
        justify-content: center;
    }
    #sidebar .header-content {
        padding: 20px 0 5px 0;
    }
    #sidebar .logo img.is-hidden-tablet {
        display: block !important; /* Mostra logo mobile no mobile */
    }
    #sidebar .logo img.is-hidden-mobile {
        display: none !important; /* Esconde logo desktop no mobile */
    }
    #canvas-column {
        display: block;
        padding: 20px 20px 0 20px !important; /* Espaçamento para o wrap */
        flex-grow: 1;
        min-height: 0; /* Previne overflow do flexbox */
        max-height: calc(100vh - 155px);
    }
    #canvas-wrap {
        display: block;
        width: 100%; /* Largura total da coluna */
        height: 100%; /* Altura total da coluna */
        aspect-ratio: unset; /* Remove a proporção fixa */
        margin: 0; /* Remove a margem vertical */
    }
    #canvasContainer {
        width: 100%;
        height: 100%;
        position: relative;
    }
    .zoom-info {
        display: none;
    }
    #right-sidebar {
        height: 60px;
    }

    /* Preloader Mobile */
    #preloader {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    .loader-content {
        position: static;
        transform: none;
        margin-bottom: 3rem;
    }
    #mouse-tracker {
        position: relative;
        top: auto;
        left: auto;
        transform: none !important; /* Garante que a animação não afete */
    }

    #creditsLink {
        bottom: 2vh;
        right: 6vw;
    }
}