:root {
    --background-color: #fff;
}

html, body {
    min-height: 100%;
}

body {
    color: var(--text-color);
    font-family: var(--font-family);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 1rem);
    padding: 0;
    margin: 0;
    > * {
        padding: 0.5rem;
    }
}

.controls {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    border-bottom: 2px solid #ddd;
    font-size: 0.8rem;
    nav ul {
        margin: 0;
        padding: 0;
        display: flex;
        gap: 0.5rem;
        li {
            list-style: none;
            padding: 0;
        }
        a {
            color: currentColor;
            text-decoration: none;
            opacity: 0.5;
            transition: opacity 0.5s, background-color 0.2s;
            padding: 0.5rem;
            display: inline-block;
            @media (hover) {
                &:hover {
                    opacity: 1;
                    background-color: #eee;
                }
            }
        }
    }
    @media (hover) {
        button {
            cursor: pointer;
        }
    }
    button[onclick="downloadCode()"] {
        background: url(/python/img/download.svg) no-repeat center;
        color: transparent;
        background-size: contain;
    }
}

#play {
    background: #000;
    color: #fff;
    border: 0px;
    font-size: 11px;
    padding: 5px 8px;
    text-align: center;
    line-height: 1.4em;
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 100;
    @media print {
        display: none;
    }
}

/* CSS */
.button-85 {
    padding: 0.6em 2em;
    border: none;
    outline: none;
    color: rgb(255, 255, 255);
    background: #111;
    cursor: pointer;
    position: relative;
    z-index: 0;
    border-radius: 10px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    display: block;
    float: right;
}

.button-85:before {
    content: "";
    background: linear-gradient(
            45deg,
            #ff0000,
            #ff7300,
            #fffb00,
            #48ff00,
            #00ffd5,
            #002bff,
            #7a00ff,
            #ff00c8,
            #ff0000
    );
    position: absolute;
    top: -2px;
    left: -2px;
    background-size: 400%;
    z-index: -1;
    filter: blur(5px);
    -webkit-filter: blur(5px);
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    animation: glowing-button-85 20s linear infinite;
    transition: opacity 0.3s ease-in-out;
    border-radius: 5px;
}

@keyframes glowing-button-85 {
    0% {
        background-position: 0 0;
    }
    50% {
        background-position: 400% 0;
    }
    100% {
        background-position: 0 0;
    }
}

.button-85:after {
    z-index: -1;
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background: #222;
    left: 0;
    top: 0;
    border-radius: 5px;
}

#console {
    background: #000;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    min-height: 1em;
    margin: 0;
    width: calc(500px - 2rem);
    overflow-x: auto;
    width: calc(100% - 2rem);
    &.invisible {
        width: 0;
        min-height: inherit;
    }
}

#error {
    background: #ffd9d9;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    color: #460000;
    min-height: 1em;
    margin: 0;
    overflow-x: scroll;
}

#screen {
    /*display: grid;*/
    /*place-content: center;*/
    position: relative;
}

#editor {
    position: relative;
}

.editor-and-canvas {
    min-height: calc(500px + 2rem);
    flex-grow: 1;
}

@media screen and (min-width: 768px) {
    .editor-and-canvas {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    #error {
        position: fixed;
        bottom: 1rem;
        width: calc(100% - 4rem);
        left: 1rem;
        box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
    }
    #editor {
        max-width: min(50vw, calc(100vw - 2rem - 500px));
    }
}

#turtle-canvas {
    --ratio: 1;
    margin: 0 auto;
    display: block;
    margin-top: 2rem;
    box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
    position: sticky;
    top: calc(50vh - 250px);
    background: #fff;
    transform: scale(var(--ratio));
    transform-origin: left;
}

@media screen and (max-width: 768px) {
    width: 100%;
    aspect-ratio: 1;
}

.visible {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.invisible {
    opacity: 0;
    pointer-events: none;
}
.cm-editor.cm-focused {
    outline: none;


}
.cm-editor {
    background: #fff;
    border-radius: 0px;
    @media screen {
        border: 2px solid #999;
        min-height: 100%;
    }

}

/* print */
@media print {
    body {
        background: none;
        display: block;
        min-height: inherit;
    }

    #turtle-canvas {
        box-shadow: none;
        margin-top: 4rem;
        position: relative;
        top: inherit;
    }
    .editor-and-canvas {
        display: flex;
        flex-direction: column-reverse;
        gap: 2rem;
        .controls {
            display: none;
        }
    }
    #editor {
        width: 500px;
        margin: 0 auto;
        /*wild guess on the height for the printer*/
        min-height: 24rem;
        display: grid;
        align-items: center;
    }

    * {
        -ms-overflow-style: none;  /* Internet Explorer 10+ */
        scrollbar-width: none;  /* Firefox */
    }

    #console {
        background: #ccc;
        color: #000;
        overflow: hidden;
    }

    .editor-and-canvas.many-lines {
        gap: 1rem;
        .cm-editor .cm-content {
            font-size: 10px;
        }
        #turtle-canvas {
            margin-top: 0;
        }
    }
    .editor-and-canvas.too-many-lines {
        gap: 0;
        .cm-editor {
            font-size: inherit;
        }
        #screen {
            height: calc(100vh - 2rem);
            display: grid;
            place-content: center;
            page-break-after: always;
        }
        #editor {
            margin-top: 2rem;
        }
    }

    .cm-editor .cm-gutters, .controls {
        display: none;
    }
    .cm-editor .cm-line span {
        color: black !important;
    }
    .cm-editor .cm-activeLine {
        background: transparent !important;
    }
    .cm-editor .ͼm {
        font-weight: bold;
    }
}

