/* ==========================================================================
   GLOBAL STYLES
   ========================================================================== */
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}


/* Custom VGA font */
@font-face {
    font-family: 'Px437';
    src: url('Px437_IBM_VGA_8x16.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Make bitmap font render crisp and pixelated (disable font smoothing)
   Applied where the Px437 font is used for a retro VGA look */
html,
body,
#screen>div,
#screen>div.fullscreen {
    -webkit-font-smoothing: none;
    /* Chrome, Safari, Opera */
    -moz-osx-font-smoothing: grayscale;
    /* Firefox on macOS */
    text-rendering: optimizeSpeed;
}

.cursor.blinking-cursor {
    display: none !important;
}

/* ==========================================================================
   SCREEN CONTAINER
   ========================================================================== */
#screen {
    --cell-w: calc(100vw / 80);
    --cell-h: calc(100vh / 25);
    --cell-size: min(var(--cell-w), calc(var(--cell-h) / 2));
    --line: round(down, calc(var(--cell-size) * 2), 1px);
    --smoothline: calc(var(--cell-size) * 2);

    width: 100vw;
    height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    background: black;
    overflow: hidden;
}

/* Terminal text overlay in v86 */
#screen>div {
    font: 24px monospace;
    display: block !important;
    width: 100vw;
    height: 100vh;
    position: fixed;
}

#screen>div.fullscreen {
    font-family: 'Px437';
    font-size: var(--line);
    line-height: var(--line);
    width: unset;
    height: unset;
}

/* 
   FORCE CANVAS TO STAY FULLSCREEN 
   Prevents v86 from shrinking the layout when GRUB/VGA changes resolution 
*/
#screen canvas {
    width: 100vw !important;
    height: 100vh !important;
    object-fit: contain;
    image-rendering: pixelated;
    position: fixed;
}

/* ==========================================================================
   CONTROLS — last-line-of-terminal bar, hacker terminal style
   ========================================================================== */
#controls {
    width: min(100%, calc(100vh * 320 / 200)) !important;
    height: auto !important;
    aspect-ratio: 320 / 200 !important;
    position: absolute !important;
    pointer-events: none;
}

#controls-bar {
    background-color: black;
    white-space: normal;
    color: #aaa;
    display: flex;
    font-family: 'Px437';
    font-size: var(--line);
    line-height: var(--line);
}


#controls #controls-bar {
    font-size: inherit;
    line-height: inherit;
    display: none;
}

/*  vga mode */
#screen:has(#textmode[style*="display: none"]) #controls-bar {
    display: flex;
    background: #0000a8;
    top: 93.5%;
    position: relative;
    font-size: var(--smoothline);
    line-height: var(--smoothline);
    padding: 0.2em 0.3em 0.05em 0.3em;
    border-top: 0.4em solid #a8a8a8;
}

#controls-bar.hidden {
    display: none !important;
}

#controls-bar input[type="file"] {
    display: none;
}

#controls-bar button {
    background: transparent;
    border: none;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    text-transform: uppercase;
    color: #aaa;
    pointer-events: all;
}

#controls-bar button:hover {
    color: #0f0;
    border-color: #0f0;
}