@font-face {
    font-family: 'IBM VGA 8x16';
    src: url('../fonts/WebPlus_IBM_VGA_8x16.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

:root {
    --dos-scale: 1;
    --dos-width:  calc(640px * var(--dos-scale));
    --dos-height: calc(400px * var(--dos-scale));
}

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

body {
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #888;
}

.screen-wrapper {
    width: fit-content;
    max-width: calc(var(--dos-width) + 14px);
    padding: 6px;
    background: #000;
    border: 1px solid #333;
    border-radius: 2px;
    line-height: 0;
    margin-top: 64px;
}

#dosScreen {
    width: var(--dos-width);
    height: var(--dos-height);
    max-width: var(--dos-width);
    max-height: var(--dos-height);
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.site-footer {
    width: calc(var(--dos-width) + 14px);
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
    line-height: 1.8;
}

.screen-size-picker {
    margin-bottom: 4px;
    color: #666;
}

.screen-size-picker span {
    margin-right: 4px;
}

.screen-size-picker a {
    color: #aaa;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s;
}

.screen-size-picker a:hover {
    color: #fff;
}

.screen-size-picker a.active {
    color: #fff;
    text-decoration: none;
}

.screen-size-picker .sep {
    margin: 0 6px;
    color: #444;
}

.site-footer p {
    color: #555;
    font-size: 11px;
}

.site-footer p a {
    color: #aaa;
    text-decoration: none;
    transition: color 0.15s;
}

.site-footer p a:hover {
    color: #fff;
}

footer {
    margin-bottom: 128px;
}

/* ── Mobile layout ────────────────────────────────────── */

@media (max-width: 660px) {
    body {
        justify-content: flex-start;
        min-height: 0;
    }

    .screen-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ── Touch controls ───────────────────────────────────── */

.touch-controls {
    width: calc(var(--dos-width) + 14px); /* match screen-wrapper: canvas + 2*6px padding + 2*1px border */
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px 0 2px;
    opacity: 0.45;
    transition: opacity 0.2s;
    user-select: none;
    -webkit-user-select: none;
}

.touch-controls:has(:active) {
    opacity: 0.9;
}

.touch-group {
    display: flex;
    gap: 5px;
}

.touch-btn {
    background: #1a1a1a;
    color: #777;
    border: 1px solid #444;
    border-color: #555 #2a2a2a #2a2a2a #555;
    font-family: monospace;
    font-size: 15px;
    min-width: 46px;
    min-height: 46px;
    padding: 4px 10px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.touch-btn:active {
    background: #2a2a2a;
    border-color: #222 #444 #444 #222;
    color: #ccc;
}
