*,
*::before,
*::after {
    box-sizing: border-box;
}

:root{
    --background:black;
    --terminal:black;
    --foreground:#33ff66;
    --prompt:#66ff99;
    --cursor:#33ff66;
    --terminal-font-size: clamp(10px, 2.8vw, 17px);
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100dvh; 
    min-height: var(--visual-vh, 100dvh); 
    height: 100%;
    font-family: "JetBrains Mono", monospace;
    font-size: var(--terminal-font-size);
    line-height: 1.2;
}

body {
    background: var(--background);
    color: var(--foreground);
    margin: 0;
}

.hidden {
    display: none !important;
}

#terminal-container {
    position: fixed;
    inset: 0;
    background: var(--terminal);
}

#terminal{
    height: 100%;
    overflow-y: auto;
    padding: 10px;
    box-sizing: border-box;
}

#input-line{
    padding-top: 1px;    
    display:flex;
    flex-wrap:wrap;
    white-space: pre;
}

#output{
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;     
}

#editor-container {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

#editor {
    flex: 1;
    width: 100%;
    resize: none;
    border: none;
    outline: none;

    background: black;
    color: #ffffff;
    
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;

    padding: 0;
    margin: 0;

    white-space: pre;
    overflow: auto;
}

#cursor{
    display:inline-block;
    width:10px;
    margin-left:2px;
    background:var(--cursor);
}

#hidden-input{
    position:absolute;
    left:-9999px;
    opacity:0;
    /* iOS Safari auto-zooms the page when a focused input's computed
       font-size is under 16px. This input is invisible, so forcing the
       size here has no visual effect but stops the zoom-on-focus jump. */
    font-size:16px;
}

::-webkit-scrollbar{
    width:10px;
}

::-webkit-scrollbar-track{
    background:#111;
}

::-webkit-scrollbar-thumb{
    background:#444;
}

::-webkit-scrollbar-thumb:hover{
    background:#666;
}

/* On-screen Tab/Esc affordances: most touch/virtual keyboards don't expose
   these keys at all, so give touch users a way to reach them. Hidden on
   devices whose primary input is a mouse/trackpad (a real keyboard already
   has these keys); shown for coarse-pointer (touch) devices. */
#mobile-toolbar{
    display:none;
}

@media (pointer: coarse) {
    #mobile-toolbar{
        display:flex;
        gap:8px;
        position:fixed;
        right:10px;
        bottom:calc(10px + env(safe-area-inset-bottom, 0px));
        z-index:10;
    }

    #mobile-toolbar button{
        font-family:inherit;
        font-size:14px;
        line-height:1;
        padding:8px 12px;
        background:rgba(255,255,255,0.08);
        color:var(--foreground);
        border:1px solid var(--foreground);
        border-radius:4px;
        touch-action:manipulation;
        -webkit-tap-highlight-color:transparent;
        user-select:none;
    }

    #mobile-toolbar button:active{
        background:rgba(255,255,255,0.2);
    }

    /* Esc only matters while the full-screen editor is open; Tab-completion
       only makes sense for normal shell input. body.editor-mode is toggled
       from js/terminal/editor.js. */
    body:not(.editor-mode) #mobile-esc-btn{
        display:none;
    }

    body.editor-mode #mobile-tab-btn{
        display:none;
    }
}