:host, html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    font-feature-settings: normal;
    font-variation-settings: normal;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(0deg,rgba(51, 0, 0, 1) 0%, rgba(153, 0, 0, 1) 50%, rgba(85, 0, 0, 1) 100%);
    font-family: 'Inter', sans-serif;
    touch-action: none; /* Prevents default touch behaviors like scrolling on the body */
    overscroll-behavior-y: contain; /* Prevents pull-to-refresh on mobile */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #333;
    margin: 0;
    padding: 0;
}

main {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

#palette-container {
    width: 282px;
    background: rgba(255, 255, 255, .1);
    padding: 10px;
    margin: 30px;
    border-radius: 16px;
    height: calc(100% - 80px);
    overflow: auto;
    flex-shrink: 0;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
    scrollbar-width: thin;
}
#palette-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
#palette-container::-webkit-scrollbar-track {
    background: transparent;
}
#palette-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .2);
    border-radius: 10px;
}
#palette-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .3);
}
#palette-items-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.5rem;
    gap: 0.5rem;
}

#canvas-parent {
    flex: 1 1 0%;
    position: relative;
    padding: 30px 0;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
}
#canvas-wrapper {
    aspect-ratio: 59 / 95;
    max-width: 100%;
    max-height: 100%;
}
#canvas {
    display: block;
    width: 100%;
    height: 100%;
    -webkit-mask-image: url('https://cc.drap.dev/old/img/mask.svg');
    mask-image: url('https://cc.drap.dev/old/img/mask.svg');
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}


#delete-btn, #spremi, #export-btn, #export-img-btn {
    background: #fff;
    font-size: 13px;
    color: #000;
    text-decoration: none;
    border: 0;
    padding: 6px 20px;
    margin-top: 15px;
    border-radius: 6px;
    cursor: pointer;
}

#export-btn, #export-img-btn {
    margin-top: 40px;
}

#instructions {
    position: absolute;
    box-shadow: 0 0 10px rgba(0,0,0,.1);
    padding: 10px 30px;
    font-size: 13px;
    line-height: 1;
    left: 0;
    top: 62px;
    background: rgba(255,255,255,.1);
    color: #fff;
    border-radius: 18px 0 0 18px;
    corner-shape: bevel;
}

#controls-container {
    top: calc(100% - 206px);
    left: calc(50% - 130px);
    position: absolute;
    padding: 12px 24px 24px 24px;
    background: rgba(150, 0, 0, 0.4);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    display: none;
    flex-direction: column;
    width: 200px;
    z-index: 20;
    box-shadow: 0 0 10px rgba(0, 0, 0, .2);
}
#controls-container.active {
    display: flex;
}
#drag-handle {
    display: flex;
    height: 6px;
    cursor: grab;
    align-items: center;
    width: 100%;
    justify-content: center;
    padding: 8px 0;
}
#drag-handle:active {
    cursor: grabbing;
}
#drag-handle > div {
    background: rgba(255, 255, 255, 0.3);
    width: 70px;
    border-radius: 3px;
    height: 6px;
}

label {
    color: #fff;
    margin-top: 8px;
    display: block;
    text-align: center;
    font-size: 13px;
}

.palette-item {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: .5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    flex-shrink: 0;
    aspect-ratio: 1;
    transition: all 0.2s ease-in-out;
    width: 80px;
    height: 80px;
    cursor: pointer;
}
.palette-item:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.palette-item img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    pointer-events: none;
    display: block;
    vertical-align: middle;
}

form {
    margin-top: 40px;
}

form > div:not(:last-child) {
    margin-bottom: 15px;
}

form label {
    display: block;
    text-align: left;
}

form input {
    display: block;
    width: 100%;
    padding: 5px 15px;
    box-sizing: border-box;
}

form .check {
    display: flex;
    align-items: flex-start;
}

form #f_privola {
    width: auto;
    margin-right: 10px;
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    cursor: pointer;
    outline: none;
    border-radius: 15px;
    height: 6px;
    background: rgba(255,255,255,.4);
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 20px;
    width: 20px;
    background-color: #900;
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 50%;
    transition: .2s ease-in-out;
}
input[type=range]::-moz-range-thumb {
    height: 20px;
    width: 20px;
    background-color: #900;
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 50%;
    transition: .2s ease-in-out;
}

#tools-container {
    position: relative;
    width: 282px;
    background: rgba(255, 255, 255, .1);
    padding: 10px;
    margin: 30px;
    border-radius: 16px;
    height: calc(100% - 80px);
    overflow: auto;
    flex-shrink: 0;
}

.sidebar h2 {
    display: none;
    font-size: 13px;
    color: #fff;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.mobile-nav {
    display: none;
}


@media screen and (min-width: 1025px) and (max-width: 1399px) {
    #palette-container, #tools-container {
        width: 190px;
    }
    #export-img-btn {
        margin-top: 20px;
    }
}

@media screen and (min-width: 768px) and (max-width: 1024px) {
    #canvas-parent {
        flex: unset;
        height: calc(84vh - 60px);
        height: calc(84vh - 60px);
    }
}

@media screen and (max-width: 1024px){

    main {
        flex-direction: column;
        height: calc(100vh - 100px);
        height: calc(100dvh - 100px);
    }
    #instructions {
        top: 0;
        width: 100%;
        border-radius: 0;
        margin: 0;
        padding: 5px 0;
        text-align: center;
    }
    #palette-container {
        width: 100%;
        margin: 0;
        padding: 0;
        height: 116px;
        position: fixed;
        bottom: 0;
        left: 0;
        border-radius: 0;
        overflow: unset;
        z-index: 9;
    }
    .palette-item {
        width: 65px;
        height: 65px;
    }
    #palette-items-wrapper {
        flex-wrap: nowrap;
        padding: 25px 15px;
        overflow: auto;
    }
    #tools-container {
        position: fixed;
        bottom: 0;
        left: 0;
        width: calc(100% - 30px);
        height: auto;
        border-radius: 0;
        margin: 0;
        z-index: 9;
    }

    .sidebar-title {
        display: none;
    } 
    
    #canvas-wrapper {
    /*  max-width: 90%;
        max-height: 90%; */
    }

    #controls-container {
        display: none;
    }

    .IroColorPicker {
        display: flex!important;
        align-items: center;
        gap: 20px;
    }

    .sidebar h2 {
        font-size: 14px;
        padding: 15px;
    }

    .mobile-nav {
        display: flex;
        align-items: center;
        gap: 1px;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 10;
        width: 100%;
        background: #fff;
        border-top: 1px solid #fff;
    }

    .mobile-nav div {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        width: 33.333%;
        height: 50px;
        font-size: 14px;
        font-weight: 700;
        background: rgb(85, 0, 0);
        color: #fff;
    }

    .mobile-nav .tab-link.active {
        opacity: 0.85;
    }

    .tools-container .tab {
        padding: 25px 15px;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .tab.tab-palette, .tools-container .tab {
        position: fixed;
        left: 0;
        bottom: 0;
        width: calc(100% - 30px);
        transform: translateY(100%);
        opacity: 0;
        transition: all 0.3s ease-in-out;
    }

    .tab.tab-palette.active, .tools-container.active .tab.active {
        transform: translateY(-50px);
        opacity: 1;
    }

    form {
        margin-top: 0;
    }

    #export-btn, #export-img-btn {
        margin-top: 15px;
    }
}

@media screen and (max-width: 390px) {
    #canvas-parent {
        flex: unset;
        height: calc(78vh - 60px);
        height: calc(78dvh - 60px);
    }
}

