:root {
    --background-body: #202b38;
    --background: #161f27;
    --background-alt: #1a242f;
    --text-main: #dbdbdb;
    --text-bright: #fff;
    --button-hover: #324759;
}

/* Base styles */
body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--background);
    color: var(--text-bright);
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow-x: hidden;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    cursor: inherit;
}

/* UI Elements */
button {
    color: var(--text-bright);
    background-color: var(--background);
    font-family: inherit;
    font-size: inherit;
    padding: 10px;
    border: 2px white solid;
    border-radius: 6px;
    outline: none;
}

button:active {
    background-color: var(--button-hover);
}

select {
    margin-right: 6px;
    margin-bottom: 6px;
    border: 2px solid white;
    border-radius: 6px;
    padding: 10px;
    color: var(--text-main);
    background-color: var(--background);
    font-family: inherit;
    font-size: inherit;
}

input {
    font-family: inherit;
    font-size: inherit;
    margin-right: 6px;
    margin-bottom: 6px;
    border: none;
    border-radius: 6px;
    padding: 10px;
    color: var(--text-bright);
    background-color: var(--background);
}

/* ROM List Grid */
.container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
}

.rom-item {
    background-color: var(--background-alt);
    border: 2px solid white;
    border-radius: 6px;
    padding: 15px;
    cursor: pointer;
    text-align: center;
    transition: transform 0.2s;
}

.rom-item:hover {
    transform: translateY(-2px);
}

/* Canvas and Game Display */
canvas {
    position: absolute;
    z-index: 1;
    image-rendering: pixelated;
}

/* Virtual Keyboard */
.vk-layer {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    touch-action: none;
}

.vk {
    color: rgba(0, 0, 0, 0.15);
    background-color: rgba(255, 255, 255, 0.25);
    position: absolute;
    z-index: 1;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25);
    text-align: center;
    vertical-align: middle;
    display: inline-block;
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
}

.vk-touched {
    background-color: rgba(255, 255, 255, 0.75) !important;
}

.vk-round { border-radius: 50% !important; }
.vk-square { border-radius: 15% !important; }
.vk-rectangle { border-radius: 5% / 10% !important; }
.vk-trig { border-radius: 10% / 35% !important; }

/* Menu and Overlays */
#menu {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    overflow: hidden scroll;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2.5px);
    -webkit-backdrop-filter: blur(2.5px);
}

#msg-layer {
    position: absolute;
    left: 0;
    width: 100%;
    top: 40vh;
    background: rgba(0, 0, 0, 0.1);
    z-index: 3;
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
    text-align: center;
}

#msg-text {
    color: var(--text-bright);
    font-size: 1.2em;
    margin: 1em;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

a, a:visited {
    color: white;
    text-decoration: none;
}

#exit-game:hover {
    background-color: var(--button-hover);
}

#exit-game:active {
    transform: translateY(1px);
}