@font-face {
    font-family: "Gameboy";
    src: url("gameboy.ttf") format("truetype");
    font-display: swap;
}

:root {
    --layout-scale: calc(100vw / 1920);
    --canvas-lift: calc(+200px * var(--layout-scale));
    --game-width: calc(100vw * 1520 / 1920);
    --game-height: calc(var(--game-width) * 720 / 1280);
    --title-gap: calc(800px * var(--layout-scale));
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    font-family: Arial, sans-serif;
    display: block !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    background: #4B2F89 !important;
}

#site-stage {
    position: relative;
    margin: 0 auto;
    width: 100vw;
    height: calc(100vw * 2789 / 1920);
    background: url("Gameboy.jpg") no-repeat center center;
    background-size: 100% 100%;
    overflow: hidden;
}

#game-shell {
    position: absolute !important;
    left: 50% !important;
    top: 0 !important;
    width: var(--game-width) !important;
    height: var(--game-height) !important;
    transform: translate(-50%, var(--canvas-lift)) !important;
    z-index: 10;
}

canvas.emscripten {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    margin: 0 !important;
    transform: none !important;
    display: block;
    border: 0 !important;
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.25);
    background: #000;
    z-index: 1;
}

canvas.emscripten:focus,
canvas.emscripten:focus-visible,
#canvas:focus,
#canvas:focus-visible {
    outline: none !important;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.25) !important;
    border: 0 !important;
}

#transfer {
    position: absolute;
    left: 50%;
    top: calc(24px * var(--layout-scale));
    transform: translateX(-50%);
    z-index: 20;
}

#game-title {
    position: absolute;
    left: 50%;
    top: calc(var(--canvas-lift) + var(--game-height) + var(--title-gap));
    transform: translateX(-50%);
    font-family: "Gameboy", Arial, sans-serif;
    font-size: calc(60px * var(--layout-scale));
    line-height: 1;
    letter-spacing: calc(2px * var(--layout-scale));
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    white-space: nowrap;
    z-index: 15;
    pointer-events: none;
}

#oak-icon {
    position: absolute;
    width: calc(402px * var(--layout-scale));
    height: calc(762px * var(--layout-scale));
    left: calc(40px * var(--layout-scale));
    bottom: calc(40px * var(--layout-scale));
    transform-origin: center center;
    transition: transform 140ms ease-out;
    z-index: 18;
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
}

#oak-icon.is-hover {
    transform: scale(1.12);
}

#speech-img {
    position: absolute;
    width: calc(479px * var(--layout-scale));
    height: calc(479px * var(--layout-scale));
    left: calc(40px * var(--layout-scale));
    bottom: calc(40px * var(--layout-scale));
    z-index: 19;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 120ms ease-out;
}

#speech-img.is-visible {
    opacity: 1;
    visibility: visible;
}

#controls-layer {
    position: absolute;
    inset: 0;
    z-index: 40;
    pointer-events: none;
}

#controls-layer .vbtn {
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    background: transparent;
    color: transparent;
    border: 4px solid transparent;
    box-shadow: none;
    font-family: "Gameboy", Arial, sans-serif;
    font-size: 18px;
    line-height: 1;
}

.attack-btn {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    transform: translateX(-50%);
}

#btn-x {
    left: calc(50% + 90px);
    bottom: 190px;
}

#btn-y {
    left: calc(50% - 90px);
    bottom: 80px;
}

#dpad {
    position: absolute;
    left: 700px;
    top: 1180px;
    width: 300px;
    height: 300px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    align-items: center;
    justify-items: center;
    pointer-events: auto;
}

.dpad-btn {
    width: 92px;
    height: 92px;
    border-radius: 18px;
    pointer-events: auto;
    padding: 0;
}

.dpad-btn.up { grid-column: 2; grid-row: 1; }
.dpad-btn.left { grid-column: 1; grid-row: 2; }
.dpad-btn.right { grid-column: 3; grid-row: 2; }
.dpad-btn.down { grid-column: 2; grid-row: 3; }

.dpad-center {
    grid-column: 2;
    grid-row: 2;
    width: 92px;
    height: 92px;
    border: 4px solid transparent;
    border-radius: 18px;
    pointer-events: none;
}

#pyconsole,
#terminal,
#crt,
#system,
#box,
.bottomright {
    display: none !important;
}
