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

html, body {
    width: 100%;
    min-height: 100%;
    height: 100%;
}

body {
    background:
        radial-gradient(circle at 50% 30%, rgba(72, 73, 142, 0.34), transparent 34%),
        linear-gradient(180deg, #0a0b18 0%, #17132c 52%, #070711 100%);
    overflow: hidden;
    font-family: 'Courier New', monospace;
    min-height: 100vh;
    display: grid;
    place-items: center;
    color: #fff;
}

.scene-shell {
    position: relative;
    display: inline-block;
    padding: 8px;
    background: #080914;
    border: 2px solid #303252;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.72),
        0 0 0 2px #111326,
        0 0 34px rgba(83, 81, 154, 0.18);
}

.scene-shell::before,
.scene-shell::after {
    content: none;
}

#gameCanvas {
    display: block;
    margin: 0 auto;
    background: linear-gradient(180deg, #0a1024, #121736);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 1px solid #51547e;
    border-radius: 0;
    box-shadow:
        inset 0 0 24px rgba(0, 0, 0, 0.34),
        0 0 22px rgba(103, 109, 200, 0.12);
}

#ui {
    position: absolute;
    top: 16px;
    left: 16px;
    color: #fff;
    z-index: 10;
    pointer-events: none;
    padding: 5px 7px;
    border-radius: 0;
    background: rgba(7, 8, 20, 0.62);
    border-left: 2px solid rgba(214, 224, 255, 0.55);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.42);
    transition: opacity 160ms ease;
}

#deaths, #timer, #strawberries, #dashes, #room-name {
    font-size: 11px;
    text-shadow: 1px 1px 0 #000;
    margin-bottom: 2px;
}

#room-name {
    font-size: 12px;
    font-weight: bold;
    color: #ffdd44;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}

#controls-help {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    color: #dfe7ff;
    z-index: 10;
    pointer-events: none;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 0;
    background: rgba(8, 9, 20, 0.68);
    border-bottom: 1px solid rgba(190, 202, 255, 0.24);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
    transition: opacity 160ms ease;
}

body:not(.game-active) #ui,
body:not(.game-active) #controls-help {
    visibility: hidden;
    opacity: 0;
}

body.room-transitioning #ui,
body.room-transitioning #controls-help {
    opacity: 0;
}

#controls-help span {
    font-size: 9px;
    text-shadow: 1px 1px 0 #000;
    white-space: nowrap;
    opacity: 0.9;
}

#touch-controls {
    display: none;
}

@media (max-width: 768px) {
    .scene-shell {
        padding: 4px;
        border-radius: 0;
    }

    .scene-shell::before,
    .scene-shell::after {
        width: 24px;
        height: 24px;
    }

    #ui {
        top: 16px;
        left: 16px;
        padding: 8px 10px;
    }

    #deaths, #timer, #strawberries, #dashes, #room-name {
        font-size: 14px;
    }

    #room-name {
        font-size: 16px;
    }

    #controls-help {
        display: none;
    }

    #touch-controls {
        position: fixed;
        right: 16px;
        bottom: 52px;
        left: 16px;
        z-index: 11;
        display: flex;
        align-items: end;
        justify-content: space-between;
        pointer-events: none;
    }

    .touch-directional {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        pointer-events: auto;
    }

    .touch-mid-row {
        display: flex;
        gap: 6px;
    }

    .touch-actions {
        display: flex;
        gap: 8px;
        align-items: flex-end;
        pointer-events: auto;
    }

    .touch-pause {
        position: absolute;
        top: -58px;
        right: 4px;
        width: 44px;
        height: 44px;
        border: 2px solid rgba(255, 255, 255, 0.7);
        border-radius: 50%;
        background: rgba(10, 10, 42, 0.78);
        color: #fff;
        font: bold 14px 'Courier New', monospace;
        touch-action: none;
        user-select: none;
        pointer-events: auto;
    }

    .touch-pause:active {
        background: rgba(0, 212, 255, 0.75);
    }

    #touch-controls button {
        width: 46px;
        height: 46px;
        border: 2px solid rgba(255, 255, 255, 0.7);
        border-radius: 6px;
        background: rgba(10, 10, 42, 0.85);
        color: #fff;
        font: bold 18px 'Courier New', monospace;
        touch-action: none;
        user-select: none;
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.16),
            0 4px 10px rgba(0, 0, 0, 0.3);
    }

    #touch-controls button:active {
        background: rgba(0, 212, 255, 0.75);
        transform: translateY(1px);
    }
}
