:root {
    --bg-color: #050510;
    --primary-color: #00ffcc;
    --secondary-color: #ff0055;
    --text-color: #ffffff;
    --hud-font: 'Courier New', Courier, monospace;
    --ui-font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--ui-font);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 800px;
    max-height: 100vh;
    aspect-ratio: 3/4;
    background: radial-gradient(circle at center, #101030 0%, #000 80%);
    box-shadow: 0 0 30px rgba(0, 255, 204, 0.1);
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated; /* Ensures sharp scaling */
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 16, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
    z-index: 10;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 15px var(--primary-color);
    letter-spacing: 2px;
    text-align: center;
    font-family: var(--hud-font);
    text-transform: uppercase;
}

.modern {
    color: var(--secondary-color);
    text-shadow: 0 0 15px var(--secondary-color);
    font-style: italic;
}

p {
    margin-bottom: 2rem;
    font-size: 1.2rem;
    color: #ccc;
    text-align: center;
    line-height: 1.5;
}

.btn {
    padding: 1rem 2rem;
    font-size: 1.5rem;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    cursor: pointer;
    font-family: var(--hud-font);
    text-transform: uppercase;
    transition: all 0.2s;
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.2);
    border-radius: 4px;
}

.btn:hover {
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.6);
    transform: scale(1.05);
}

.btn:active {
    transform: scale(0.95);
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    font-family: var(--hud-font);
    font-size: 1.2rem;
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
    pointer-events: none;
    z-index: 5;
}

.hud-item {
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-item span {
    font-size: 1.5rem;
    color: #fff;
}

.touch-hint {
    display: none;
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: -1rem;
}

@media (hover: none) and (pointer: coarse) {
    .touch-hint {
        display: block;
    }
}

@media (max-width: 600px) {
    #game-container {
        width: 100%;
        height: 100vh;
        max-width: none;
        max-height: none;
        aspect-ratio: unset;
        border-radius: 0;
    }

    h1 { font-size: 2rem; }
    .btn { font-size: 1.2rem; padding: 0.8rem 1.6rem; }
    #hud { font-size: 0.8rem; padding: 0.5rem; }
    .hud-item span { font-size: 1rem; }

    /* Adjust for notched phones */
    #hud {
        padding-top: env(safe-area-inset-top);
    }
}
