body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #87CEEB;
    font-family: 'Jua', sans-serif;
    user-select: none;
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 30px;
    z-index: 10;
    font-weight: bold;
    pointer-events: none;
    text-shadow: 1px 1px 2px #000;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    padding: 20px;
    display: flex;
    box-sizing: border-box;
}

#player-stats {
    background: rgba(20, 20, 30, 0.8);
    color: white;
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #555;
    width: 260px;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

#player-stats h2 {
    margin: 0 0 15px 0;
    color: #ff5555;
    text-shadow: 1px 1px 2px #000;
    font-size: 24px;
}

#player-stats p {
    margin: 8px 0;
    font-size: 18px;
    text-shadow: 1px 1px 2px #000;
}

.tab-hidden {
    display: none !important;
}

#hp-container {
    position: absolute;
    bottom: 105px;
    /* Above hotbar */
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    text-align: center;
    pointer-events: none;
    z-index: 25;
}

#hp-text {
    font-size: 16px;
    color: white;
    text-shadow: 1px 1px 2px #000;
    margin-top: -18px;
    position: relative;
    z-index: 26;
}

.health-bar-container {
    width: 100%;
    height: 16px;
    background: #333;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 5px;
    border: 1px solid #000;
}

#health-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #cc0000, #ff0000);
    transition: width 0.2s;
}

#game-message {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    color: #ffdd44;
    text-shadow: 3px 3px 6px #000;
    transition: opacity 0.5s;
    opacity: 0;
}

#game-message.show {
    opacity: 1;
}

#blocker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.8));
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

#instructions {
    background: rgba(30, 30, 45, 0.95);
    padding: 50px;
    border-radius: 20px;
    border: 4px solid #ffaa00;
    text-align: center;
    cursor: pointer;
    color: white;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.9);
    transition: transform 0.2s;
}

#instructions:hover {
    transform: scale(1.02);
}

kbd {
    background: #eee;
    color: #333;
    padding: 3px 8px;
    border-radius: 4px;
    border-bottom: 3px solid #ccc;
    font-family: sans-serif;
    font-weight: bold;
    margin: 0 3px;
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
    font-size: 20px;
    text-align: left;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 10px;
}

.hidden {
    display: none !important;
}

#shop-ui,
#upgrade-shop-ui {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(40, 40, 50, 0.95);
    padding: 30px;
    border-radius: 20px;
    border: 3px solid #00dd00;
    width: 650px;
    text-align: center;
    z-index: 50;
    color: white;
    box-shadow: 0 0 50px rgba(0, 255, 0, 0.2), inset 0 0 20px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

#upgrade-shop-ui {
    border-color: #00ffff;
    box-shadow: 0 0 50px rgba(0, 255, 255, 0.2);
}

#shop-ui h2,
#upgrade-shop-ui h2 {
    margin-top: 0;
    color: #00ff00;
    font-size: 32px;
    text-shadow: 2px 2px 4px #000;
}

#upgrade-shop-ui h2 {
    color: #00ffff;
}


#close-shop-btn,
#close-upgrade-shop-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #ff4444;
    color: white;
    border: none;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

#close-shop-btn:hover,
#close-upgrade-shop-btn:hover {
    background: #ff6666;
    transform: rotate(90deg);
}

#shop-items {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
}

.shop-category {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 10px;
    flex: 1;
}

.shop-category h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #ffaa00;
    font-size: 20px;
    text-shadow: 1px 1px 2px #000;
}

#shop-items button,
#upgrade-items button {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    font-size: 18px;
    font-family: inherit;
    font-weight: bold;
    color: white;
    background: linear-gradient(to bottom, #448844, #225522);
    border: 2px solid #55aa55;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.1s;
}

#shop-items button:hover,
#upgrade-items button:hover {
    background: linear-gradient(to bottom, #55aa55, #337733);
    transform: scale(1.03);
}

#upgrade-items button {
    background: linear-gradient(to bottom, #008888, #004444);
    border-color: #00aaaa;
}

#upgrade-items button:hover {
    background: linear-gradient(to bottom, #00aaaa, #006666);
}


#death-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-shadow: 2px 2px 4px #000;
}

#death-overlay h1 {
    font-size: 80px;
    margin-bottom: 10px;
}

#death-overlay p {
    font-size: 30px;
}

#victory-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 50, 0, 0.7);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-shadow: 2px 2px 4px #000;
}

#victory-overlay h1 {
    font-size: 80px;
    margin-bottom: 10px;
}

#victory-overlay p {
    font-size: 30px;
}

@keyframes shake {
    0% {
        transform: translate(2px, 2px) rotate(0deg);
    }

    10% {
        transform: translate(-2px, -3px) rotate(-1deg);
    }

    20% {
        transform: translate(-4px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(4px, 3px) rotate(0deg);
    }

    40% {
        transform: translate(2px, -2px) rotate(1deg);
    }

    50% {
        transform: translate(-2px, 3px) rotate(-1deg);
    }

    60% {
        transform: translate(-4px, 2px) rotate(0deg);
    }

    70% {
        transform: translate(4px, 2px) rotate(-1deg);
    }

    80% {
        transform: translate(-2px, -2px) rotate(1deg);
    }

    90% {
        transform: translate(2px, 3px) rotate(0deg);
    }

    100% {
        transform: translate(2px, -3px) rotate(-1deg);
    }
}

.screen-shake {
    animation: shake 0.3s cubic-bezier(.36, .07, .19, .97) both;
}

#hotbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 10px;
    border: 3px solid #333;
    z-index: 20;
}

#shop-ui:not(.hidden)~#ui-layer #hotbar {
    pointer-events: auto;
    cursor: pointer;
}

#ui-layer:not(.hidden) #hotbar {
    pointer-events: auto;
}

#hotbar:hover {
    background: rgba(20, 20, 30, 0.7);
}

.hotbar-slot {
    width: 60px;
    height: 60px;
    background: rgba(50, 50, 60, 0.8);
    border: 3px solid #555;
    border-radius: 5px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    color: white;
    cursor: pointer;
    pointer-events: auto;
}

.hotbar-slot.moving {
    border-color: #ffff00;
    background: rgba(255, 255, 0, 0.3);
    box-shadow: 0 0 15px #ffff00;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.hotbar-slot.selected {
    border-color: #00ff00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    transform: scale(1.1);
    z-index: 2;
}

.slot-key {
    position: absolute;
    top: -8px;
    left: 2px;
    font-size: 14px;
    color: #fff;
    text-shadow: 1px 1px 1px #000;
    font-weight: bold;
}

.slot-count {
    position: absolute;
    bottom: -15px;
    right: 2px;
    font-size: 16px;
    color: #fff;
    text-shadow: 1px 1px 1px #000;
}

.kit-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.kit-card {
    background: rgba(0, 0, 0, 0.5);
    border: 3px solid #555;
    padding: 15px;
    border-radius: 10px;
    width: 200px;
    cursor: pointer;
    transition: 0.2s;
}

.kit-card:hover {
    border-color: #ffaa00;
}

.kit-card.selected {
    border-color: #00ff00;
    background: rgba(0, 50, 0, 0.5);
}

#start-btn {
    padding: 15px 30px;
    font-size: 24px;
    font-family: inherit;
    font-weight: bold;
    background: #ff5555;
    color: white;
    border: 3px solid #aa0000;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    transition: 0.2s;
    margin-top: 10px;
}

#start-btn:hover {
    background: #ff7777;
    transform: scale(1.05);
}