:root {
    --color-light: #fff;
    --color-dark: #000;
    --color-text: #ccc;
    --color-text-subtle: #888;
    --color-background: var(--color-dark);
    --color-background-transparent: rgba(20,20,20,0.8);
    --color-main: #0085ff;
    --color-border: #222;

    --border-radius: 6px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

a {
    color: var(--color-main);
    text-decoration: none;
}


@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

[x-cloak] {
    display: none;
}

body {
    overflow: hidden;
    background: var(--color-background);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    position: relative;
}

.tiefling {
    display: grid;
    width: 100vw;
    height: 100vh;
    align-items: center;
    justify-content: center;
    transition: all 250ms;

    &.dragging {
        opacity: 0.5;
        filter: blur(10px);
        transition: all 250ms;
    }
}

.input {
    display: block;
    width: 100%;
    height: 40px;
    padding: 10px;
    background: var(--color-background);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);

    @media (max-width: 500px) {
        font-size: 16px;
    }

    &:focus {
        outline: none;
        border-color: var(--color-main);
    }
}

.controls {
    position: fixed;
    top: 0;
    right: 0;

    .top {
        position: absolute;
        top: 0;
        right: 0;
        text-align: right;
        width: 340px;

        .states {
            display: inline-block;
            margin-right: 10px;
            vertical-align: top;
            padding-top: 18px;
            text-shadow: rgba(0,0,0,0.3) 0 1px 0;
        }

        .toggle-menu {
            display: inline-block;
            cursor: pointer;
            color: var(--color-text);
            padding: 20px;

            & svg {
                display: inline-block;
                width: 20px;
                height: 20px;

                filter: drop-shadow(0 1px 0px rgba(0,0,0,0.3));
            }

            &:hover {
                color: var(--color-main);
            }
        }
    }

}


/* states */
.states {
    .state {
        display: inline-block;

        &.state-loading .svg-wrap {
            display: inline-block;
            transform: translateY(2px);

            & svg {
                display: inline-block;
                color: var(--color-text);
                width: 20px;
                height: 20px;
                vertical-align: bottom;
                animation: rotate 3s linear infinite;
            }
        }
    }
}


/* File Upload */

.menu {
    position: absolute;
    top: 50px;
    right: 20px;
    background: var(--color-background-transparent);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    width: calc(100vw - 40px);

    max-width: 350px;
    max-height: calc(100vh - 50px - 20px);

    font-size: 14px;


    & label {
        display: block;
        font-size: 14px;
        font-weight: 400;
        margin: 0 0 5px var(--border-radius);

        .info {
            display: block;
            font-size: 10px;
            color: var(--color-text-subtle);
            margin-left: 0;
        }
    }

    .info {
        font-size: 10px;
        margin: 5px 0 5px var(--border-radius);
        color: var(--color-text-subtle);
    }

    & input {

        &[type="range"] {
            height: auto;
            padding: 0;
            color: var(--color-text);
        }
    }

    .menu-group {
        border-bottom: 1px solid var(--color-border);
        padding: 15px 15px 0 15px;

        &:last-child {
            border-bottom: none;
        }
    }

    .menu-row {
        margin-bottom: 20px;
    }

}

.file-upload {
    position: relative;

    & input[type="url"] {
        padding: 10px 40px 10px 10px;
    }

    button.upload {
        appearance: none;
        -webkit-appearance: none;
        border: none;
        background: none;

        display: grid;
        justify-content: center;
        align-items: center;
        position: absolute;

        top: 0;
        right: 0;
        width: 40px;
        height: 40px;

        padding: 0;
        cursor: pointer;

        & svg {
            display: block;
            width: 16px;
            height: 16px;
            color: var(--color-text);
        }

        &:hover svg {
            color: var(--color-main);
        }
    }

    .preview {
        position: relative;
        margin-top: 5px;
        border: 1px solid var(--color-border);
        background: var(--color-background);
        border-radius: var(--border-radius);
        overflow: hidden;


        & a.preview-image {
            display: block;
        }
        & img {
            display: block;
            max-height: 100px;
            min-height: 30px;
            max-width: 100%;
            margin: 0 auto;
        }
        & a.remove {
            display: grid;
            justify-content: center;
            align-items: center;
            position: absolute;
            top: 3px;
            right: 0;
            width: 34px;
            height: 28px;
            color: var(--color-text);
            border-bottom-left-radius: 15px;

            &:hover {
                color: var(--color-main);
            }

            & svg {
                width: 16px;
                height: 16px;
                transform: translate(-2px, 2px);
            }
        }
    }

    &.dragging {
        & input[type="url"] {
            border-color: var(--color-main);
            background: var(--color-main);
            color: var(--color-border);

            &::placeholder {
                color: var(--color-border);
            }
        }
    }

}

.input-range-number {
    display: grid;
    grid-template-columns: 1fr 70px;
    grid-gap: 10px;

    & input[type="range"] {
        width: 100%;
    }
    & input[type="number"] {
        width: 100%;
        padding-right: 5px;
    }

    .range-info {
        display: grid;
        grid-template-columns: 1fr 1fr;
        font-size: 10px;
        margin: 5px 0 5px 5px;
        color: var(--color-text-subtle);

        &.full {
            grid-template-columns: 1fr;
        }

        .col.col-right {
            text-align: right;
        }

    }
}

.input-radios {

    margin-bottom: 15px;

    & .col {
        width: 25%;
        white-space: nowrap;
    }

    & input {
        display: none;
    }
    & label {
        display: inline-block;
    }

    .labels {
        display: flex;
        border-radius: var(--border-radius);
        border: 1px solid var(--color-border);
        overflow: hidden;

        & label {
            flex: 1;
            text-align: center;
            padding: 10px 0;
            border-left: 1px solid var(--color-border);
            margin: 0;

            &:first-child {
                border-left: none;
            }

            &.active {
                color: var(--color-light);
                background: var(--color-main);
                border-left-color: var(--color-main);
            }

            /* the label before and left to the .active label */
            &.active + label {
                border-left-color: var(--color-main);
            }

        }
    }

}

.input-checkbox {
    margin-bottom: 15px;

    & input {
        display: inline-block;
        width: auto;
        height: auto;
        margin: 0 3px 0 0;
        transform: translateY(2px);
    }
    & label {
        display: inline-block;
        margin: 0;
    }
}

.menu .menu-group-about {
    padding-top: 0;

    .menu-row {
        margin-bottom: 0;
        & > a {
            display: inline-block;
            padding: 15px 0 15px 0;

            &.image-link {
                padding-top: 0;
            }
        }

        .privacy-policy {
            & p:first-child {
                margin-top: 0;
            }
        }
    }
}



.button {
    display: block;
    width: 100%;
    color: var(--color-light);
    background: var(--color-main);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-size: 14px;

    &[disabled] {
        background: var(--color-text-subtle);
        cursor: not-allowed;
    }

    &.states .state-loading .svg-wrap {
        display: inline-block;
        transform: translateY(0);

        & svg {
            display: inline-block;
            color: var(--color-light);
            width: 16px;
            height: 16px;
            vertical-align: bottom;
            animation: rotate 3s linear infinite;
        }
    }

    &.button-share {
        padding: 3px 10px 5px 10px;

        & svg {
            display: inline-block;
            width: 16px;
            transform: translate(3px, 3px);
        }

    }

}

.bookmarklet {
    display: inline-block;
    background: var(--color-text-subtle);
    color: var(--color-light);
    border-radius: 30px;
    padding: 7px 12px;
    margin-top: 12px;
}

.example-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    grid-gap: 5px;

    .example-image {
        display: grid;
        position: relative;
        height: 58.5px;
        border-radius: var(--border-radius);
        background-color: var(--color-dark);
        background-size: contain;
        background-position: 50% 50%;
        background-repeat: no-repeat;
        border: 1px solid var(--color-border);

    }

}

.simplebar-vertical .simplebar-scrollbar:before {
    left: 2px;
    right: 6px;
    background-color: var(--color-text);
}

body.hide-interface {
    .controls {
        display: none;
    }
    cursor: none !important;
}

.share {

    .state-ready {
        width: 100%;
        display: grid;
        grid-template-columns: 90px 1fr;
        grid-gap: 5px;
    }

    .state-uploading {
        & svg {
            display: inline-block;
            width: 20px;
            height: 20px;
            vertical-align: middle;
            animation: rotate 3s linear infinite;
        }
    }
    .state-error {
        color: red;
    }
    .state-uploaded {
        display: grid;
        grid-template-columns: 1fr 50px;
        grid-gap: 5px;

        & input {
            display: block;
            width: 100%;
            padding: 10px;
            background: var(--color-background);
            color: var(--color-text);
            border: 1px solid var(--color-border);
            border-radius: var(--border-radius);
        }

        .button-copy {
            display: grid;
            justify-content: center;
            align-items: center;
            & svg {
                width: 18px;
            }
        }
    }
}