:root {
    --gold: #f3c948;
    --gold-bright: #ffe77d;
    --red: #c72a20;
    --red-dark: #620c08;
    --black: #070201;
    --cream: #fff2c6;
    --panel: rgba(26, 5, 3, 0.96);
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    color: white;
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at 50% 25%, #67150e 0%, #190503 48%, #040101 100%);
}

button {
    font-family: inherit;
}

#game-shell {
    display: grid;
    grid-template-rows: auto 1fr auto;
    width: 100vw;
    height: 100vh;
}

#top-bar {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 105px;
    padding: 10px 20px;
    border-bottom: 4px solid var(--gold);
    background:
        repeating-linear-gradient(
            -45deg,
            #0d0805 0 15px,
            #191008 15px 30px
        );
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8);
}

.small-title {
    margin-bottom: 2px;
    color: #c2a55e;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 4px;
}

#branding h1 {
    margin: 0;
    color: white;
    font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
    font-size: clamp(30px, 4.8vw, 62px);
    line-height: 0.85;
    letter-spacing: 2px;
    text-shadow:
        3px 3px 0 #8d170f,
        6px 6px 0 #240302;
}

#branding h1 span {
    color: var(--gold);
}

#stats {
    display: flex;
    gap: 8px;
}

.stat-box {
    min-width: 92px;
    padding: 8px 11px;
    text-align: center;
    border: 2px solid #876822;
    border-radius: 8px;
    background: #080302;
    box-shadow: inset 0 0 15px black;
}

.stat-box span {
    display: block;
    color: #d2ba72;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1px;
}

.stat-box strong {
    display: block;
    margin-top: 2px;
    color: white;
    font-family: Impact, sans-serif;
    font-size: 27px;
    letter-spacing: 1px;
}

#game-stage {
    position: relative;
    overflow: hidden;
    cursor: none;
    background:
        linear-gradient(
            rgba(40, 5, 3, 0.32),
            rgba(0, 0, 0, 0.9)
        ),
        repeating-linear-gradient(
            90deg,
            transparent 0 89px,
            rgba(255, 225, 135, 0.035) 90px
        ),
        repeating-linear-gradient(
            0deg,
            transparent 0 89px,
            rgba(255, 225, 135, 0.025) 90px
        ),
        #1a0705;
}

#game-stage::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -25px;
    width: min(700px, 85vw);
    height: 330px;
    opacity: 0.14;
    transform: translateX(-50%);
    background:
        linear-gradient(
            90deg,
            transparent 0 8%,
            #f2d78a 8% 12%,
            transparent 12% 17%,
            #f2d78a 17% 21%,
            transparent 21% 26%,
            #f2d78a 26% 30%,
            transparent 30% 70%,
            #f2d78a 70% 74%,
            transparent 74% 79%,
            #f2d78a 79% 83%,
            transparent 83% 88%,
            #f2d78a 88% 92%,
            transparent 92%
        );
    clip-path: polygon(
        0 100%,
        0 77%,
        12% 77%,
        12% 53%,
        25% 53%,
        25% 36%,
        36% 36%,
        36% 17%,
        44% 17%,
        47% 5%,
        50% 0,
        53% 5%,
        56% 17%,
        64% 17%,
        64% 36%,
        75% 36%,
        75% 53%,
        88% 53%,
        88% 77%,
        100% 77%,
        100% 100%
    );
    background-color: #f2d78a;
}

#game-canvas {
    position: absolute;
    inset: 0;
    z-index: 5;
    width: 100%;
    height: 100%;
}

#background-message {
    position: absolute;
    top: 15px;
    z-index: 2;
    width: 100%;
    color: white;
    opacity: 0.09;
    text-align: center;
    font-family: Impact, sans-serif;
    font-size: clamp(25px, 6vw, 80px);
    letter-spacing: 8px;
}

#crosshair {
    position: absolute;
    z-index: 40;
    width: 126px;
    height: 175px;
    pointer-events: none;
    transform:
        translate(-50%, -45%)
        rotate(-18deg);
    transform-origin: 50% 78%;
    filter: drop-shadow(9px 12px 5px rgba(0, 0, 0, 0.65));
}

#crosshair.swatting {
    animation: swat 140ms ease-out;
}

.swatter-grid {
    position: absolute;
    top: 0;
    left: 8px;
    width: 108px;
    height: 79px;
    overflow: hidden;
    border: 8px solid #cc3026;
    border-radius: 38%;
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0 8px,
            rgba(97, 5, 2, 0.9) 8px 11px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(220, 47, 37, 0.92) 0 8px,
            rgba(97, 5, 2, 0.85) 8px 11px
        );
}

.swatter-handle {
    position: absolute;
    top: 68px;
    left: 54px;
    width: 17px;
    height: 110px;
    border-radius: 9px;
    background:
        linear-gradient(
            90deg,
            #5d0805,
            #f14b3f,
            #670a06
        );
}

@keyframes swat {
    0% {
        transform:
            translate(-50%, -45%)
            rotate(-18deg)
            scale(1);
    }

    45% {
        transform:
            translate(-50%, -45%)
            rotate(18deg)
            scale(0.7);
    }

    100% {
        transform:
            translate(-50%, -45%)
            rotate(-18deg)
            scale(1);
    }
}

#spray-cloud {
    position: absolute;
    z-index: 35;
    width: 370px;
    height: 230px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background:
        radial-gradient(
            circle,
            rgba(206, 255, 79, 0.9),
            rgba(89, 193, 42, 0.55) 42%,
            rgba(29, 113, 21, 0.2) 65%,
            transparent 76%
        );
    filter: blur(10px);
}

#spray-cloud.active {
    opacity: 1;
    animation: fog-pulse 180ms infinite alternate;
}

@keyframes fog-pulse {
    from {
        transform:
            translate(-50%, -50%)
            scale(0.82);
    }

    to {
        transform:
            translate(-50%, -50%)
            scale(1.16);
    }
}

#message-banner {
    position: absolute;
    left: 50%;
    top: 15%;
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transform:
        translateX(-50%)
        scale(0.5)
        rotate(-6deg);
    color: #fff5ca;
    font-family: Impact, sans-serif;
    font-size: clamp(44px, 8vw, 110px);
    white-space: nowrap;
    text-shadow:
        4px 4px 0 #cf251b,
        8px 8px 0 #4a0704,
        13px 13px 18px black;
}

#message-banner.show {
    animation: message-pop 700ms ease-out;
}

@keyframes message-pop {
    0% {
        opacity: 0;
        transform:
            translateX(-50%)
            scale(0.3)
            rotate(-12deg);
    }

    22% {
        opacity: 1;
        transform:
            translateX(-50%)
            scale(1.25)
            rotate(4deg);
    }

    75% {
        opacity: 1;
        transform:
            translateX(-50%)
            scale(1)
            rotate(-2deg);
    }

    100% {
        opacity: 0;
        transform:
            translateX(-50%)
            scale(1.45)
            rotate(0);
    }
}

.overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: none;
    place-items: center;
    padding: 18px;
    cursor: default;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(6px);
}

.overlay.visible {
    display: grid;
}

.panel {
    width: min(760px, 96vw);
    max-height: 95%;
    overflow-y: auto;
    padding: clamp(28px, 5vw, 58px);
    text-align: center;
    border: 5px solid var(--gold);
    border-radius: 17px;
    background:
        radial-gradient(
            circle at top,
            #67150e,
            #180403 70%
        );
    box-shadow:
        0 0 0 8px #68110b,
        0 0 70px black;
}

.warning-icon {
    font-size: 65px;
    animation: warning 600ms infinite alternate;
}

@keyframes warning {
    from {
        opacity: 0.45;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1.1);
    }
}

.panel-kicker {
    margin-bottom: 8px;
    color: #cab26c;
    font-weight: 900;
    letter-spacing: 4px;
}

.panel h2 {
    margin: 8px 0 18px;
    color: var(--gold);
    font-family: Impact, sans-serif;
    font-size: clamp(42px, 8vw, 82px);
    line-height: 0.9;
    text-shadow:
        4px 4px 0 #8e160f,
        8px 8px 0 #2a0302;
}

.panel p {
    max-width: 650px;
    margin: 0 auto 20px;
    color: #fff2ca;
    font-size: clamp(17px, 2.3vw, 22px);
    font-weight: 700;
    line-height: 1.45;
}

.instructions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
    margin: 25px 0;
}

.instructions div {
    padding: 16px;
    border: 2px solid #876822;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.42);
}

.instructions strong,
.instructions span {
    display: block;
}

.instructions strong {
    margin-bottom: 5px;
    color: var(--gold);
    font-size: 20px;
}

.instructions span {
    font-weight: 700;
}

#start-button,
#restart-button {
    width: min(440px, 100%);
    padding: 18px 22px;
    border: 4px solid var(--gold-bright);
    border-radius: 10px;
    color: white;
    background:
        linear-gradient(
            #ed473a,
            #8b110c
        );
    box-shadow:
        0 8px 0 #430604,
        0 15px 25px black;
    font-family: Impact, sans-serif;
    font-size: clamp(27px, 4.5vw, 43px);
    letter-spacing: 1px;
    cursor: pointer;
}

#start-button:active,
#restart-button:active {
    transform: translateY(7px);
    box-shadow:
        0 1px 0 #430604,
        0 6px 12px black;
}

.parody-note {
    margin-top: 28px;
    color: #958872;
    font-size: 12px;
}

#final-score {
    margin: 10px 0 28px;
    color: var(--gold);
    font-family: Impact, sans-serif;
    font-size: 90px;
}

#weapon-bar {
    position: relative;
    z-index: 35;
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    min-height: 100px;
    padding: 9px 13px;
    border-top: 4px solid var(--gold);
    background:
        repeating-linear-gradient(
            -45deg,
            #0c0704 0 13px,
            #181008 13px 26px
        );
    box-shadow: 0 -5px 18px black;
}

.weapon,
.utility-button {
    min-width: 175px;
    padding: 8px 15px;
    border: 3px solid #715522;
    border-radius: 9px;
    color: white;
    background:
        linear-gradient(
            #302319,
            #0d0805
        );
    cursor: pointer;
}

.weapon.active {
    border-color: #ffe993;
    background:
        linear-gradient(
            #c62c22,
            #5e0c08
        );
    box-shadow:
        0 0 18px rgba(255, 210, 85, 0.45);
}

.weapon span,
.weapon small {
    display: block;
}

.weapon-icon {
    float: left;
    margin-right: 9px;
    font-size: 32px;
}

.weapon-name {
    font-weight: 900;
}

.weapon small {
    margin-top: 4px;
    color: #e1cb8c;
    font-weight: 800;
}

.utility-button {
    min-width: 140px;
    font-weight: 900;
}

@media (max-width: 850px) {
    #top-bar {
        min-height: 75px;
        padding: 7px 9px;
    }

    .small-title {
        display: none;
    }

    #branding h1 {
        font-size: 29px;
    }

    #stats {
        gap: 4px;
    }

    .stat-box {
        min-width: 57px;
        padding: 5px;
    }

    .stat-box span {
        font-size: 7px;
    }

    .stat-box strong {
        font-size: 18px;
    }

    #weapon-bar {
        min-height: 78px;
        gap: 4px;
        padding: 5px;
    }

    .weapon,
    .utility-button {
        min-width: 0;
        flex: 1;
        padding: 5px;
        font-size: 11px;
    }

    .weapon-icon {
        float: none;
        margin: 0;
        font-size: 21px;
    }

    .instructions {
        grid-template-columns: 1fr;
    }

    #crosshair {
        width: 95px;
        height: 140px;
    }

    .swatter-grid {
        width: 80px;
        height: 61px;
    }

    .swatter-handle {
        top: 54px;
        left: 41px;
        height: 88px;
    }

    #spray-cloud {
        width: 260px;
        height: 170px;
    }
}
