* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

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

body {
    margin: 0;
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
    color: #f7fbff;
    background: #050714;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

.hud {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    left: 12px;
    right: 12px;
    display: grid;
    gap: 8px;
    pointer-events: none;
    max-width: calc(100vw - 24px);
}

.brand,
.stat-row,
.weapon-strip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand {
    justify-content: space-between;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
    text-shadow: 0 0 14px rgba(0, 229, 255, 0.65);
}

.brand a {
    pointer-events: auto;
    color: #77f7ff;
    text-decoration: none;
    font-size: 0.78rem;
    padding: 8px 10px;
    border: 1px solid rgba(119, 247, 255, 0.5);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.28);
}

.stat-row {
    justify-content: space-between;
}

.health {
    width: min(260px, 58vw);
    height: 18px;
    padding: 3px;
    border: 1px solid rgba(119, 247, 255, 0.62);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.36);
    box-shadow: 0 0 18px rgba(0, 229, 255, 0.24);
}

.health span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #00f5a0, #00e5ff);
    box-shadow: 0 0 12px rgba(0, 245, 160, 0.78);
    transition: width 120ms ease;
}

.score,
.weapon-strip {
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.34);
    font-weight: 900;
    box-shadow: 0 0 18px rgba(0, 0, 0, 0.28);
}

.weapon-strip {
    width: fit-content;
    max-width: calc(100vw - 24px);
    min-height: 34px;
    flex-wrap: wrap;
    color: rgba(247, 251, 255, 0.7);
    font-size: 0.82rem;
}

.weapon {
    color: rgba(247, 251, 255, 0.74);
}

.weapon.active {
    color: #fff;
    text-shadow: 0 0 10px #ff2ee9;
}

.start-panel,
.game-over {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(180deg, rgba(5, 7, 20, 0.1), rgba(5, 7, 20, 0.74));
}

.start-panel > div,
.game-over > div {
    width: 100%;
    max-width: 520px;
    padding: 24px;
    border: 1px solid rgba(119, 247, 255, 0.35);
    border-radius: 8px;
    background: rgba(5, 7, 20, 0.82);
    box-shadow: 0 0 44px rgba(0, 229, 255, 0.18);
}

.eyebrow {
    margin: 0 0 8px;
    color: #77f7ff;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0 0 12px;
    line-height: 1;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(2.55rem, 11vw, 5rem);
    overflow-wrap: anywhere;
}

h2 {
    font-size: clamp(2rem, 9vw, 3.7rem);
}

p {
    margin: 0 0 18px;
    color: rgba(247, 251, 255, 0.78);
    line-height: 1.5;
}

button {
    min-height: 44px;
    border: 0;
    border-radius: 6px;
    color: #051018;
    background: #77f7ff;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 0 18px rgba(119, 247, 255, 0.48);
}

.start-panel button,
.game-over button {
    width: 100%;
    padding: 12px 18px;
}

@media (max-width: 620px) {
    .brand {
        font-size: 0.86rem;
    }

    .start-panel,
    .game-over {
        padding: 14px;
    }

    .start-panel > div,
    .game-over > div {
        padding: 18px;
        max-width: calc(100vw - 28px);
    }

    h1 {
        font-size: clamp(2.1rem, 10vw, 2.65rem);
    }

}

body.motorbeam-mobile {
    background: #a8a8a8;
}

body.motorbeam-mobile #gameboy-shell {
    z-index: 1;
}

body.motorbeam-mobile #gameboy-screen-bezel {
    aspect-ratio: 10 / 9;
}

body.motorbeam-mobile #gameboy-screen-bezel canvas {
    image-rendering: auto;
}

body.motorbeam-mobile .gb-brand {
    color: #273a46;
    font-size: 16px;
}

body.motorbeam-mobile .hud {
    z-index: 2;
    top: calc(58px + env(safe-area-inset-top));
    left: max(22px, calc((100vw - 400px) / 2 + 16px));
    right: max(22px, calc((100vw - 400px) / 2 + 16px));
    gap: 5px;
}

body.motorbeam-mobile .brand {
    font-size: 0.72rem;
}

body.motorbeam-mobile .brand a {
    padding: 5px 7px;
}

body.motorbeam-mobile .health {
    height: 14px;
    width: min(190px, 50vw);
}

body.motorbeam-mobile .score,
body.motorbeam-mobile .weapon-strip {
    padding: 5px 7px;
    font-size: 0.72rem;
}

body.motorbeam-mobile .weapon-strip {
    min-height: 28px;
}

body.motorbeam-mobile .start-panel,
body.motorbeam-mobile .game-over {
    z-index: 3;
}

body.motorbeam-mobile .start-panel > div,
body.motorbeam-mobile .game-over > div {
    max-width: min(360px, calc(100vw - 34px));
    padding: 18px;
}

body.motorbeam-mobile h1 {
    font-size: clamp(2rem, 10vw, 2.65rem);
}
