:root {
    --neon-green: #39ff14;
    --neon-red: #ff3131;
    --neon-blue: #00f2ff;
    --dark-bg: #0d0221;
    --grid-color: rgba(57, 255, 20, 0.1);
    --common-color: #9e9e9e;
    --rare-color: #00aaff;
    --legendary-color: #ffd700;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--dark-bg);
    font-family: 'Orbitron', sans-serif;
    color: white;
    user-select: none;
    -webkit-user-select: none;
}

canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    transition: filter 0.1s ease-out;
}

canvas.shake {
    animation: shake 0.1s 1;
}

@keyframes shake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-2px, 2px); }
    50% { transform: translate(2px, -2px); }
    75% { transform: translate(-2px, -2px); }
}

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none;
}

#stats {
    display: flex;
    gap: 30px;
    font-size: 1.2em;
    text-shadow: 0 0 5px var(--neon-green), 0 0 10px var(--neon-green);
}

#xp-bar-container {
    width: 100%;
    max-width: 600px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--neon-blue);
    border-radius: 10px;
    box-shadow: 0 0 10px var(--neon-blue);
    position: relative;
}

#xp-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00f2ff, #2979ff);
    border-radius: 8px;
    transition: width 0.2s ease-in-out;
}

#xp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8em;
    text-shadow: 1px 1px 2px black;
}

/* Modal & Menus */
.hidden {
    display: none !important;
}

#level-up-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.level-up-title {
    font-size: 3em;
    color: var(--legendary-color);
    text-shadow: 0 0 5px var(--legendary-color), 0 0 15px var(--legendary-color), 0 0 30px var(--legendary-color);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#upgrade-cards-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.upgrade-card {
    width: 200px;
    height: 280px;
    background: rgba(20, 20, 40, 0.7);
    border: 2px solid;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 10px;
}

.upgrade-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 0 25px;
}

.card-rarity {
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.8em;
}

.card-title {
    font-size: 1.4em;
    margin-top: 10px;
}

.card-description {
    font-size: 0.9em;
    margin-top: 15px;
    color: #ccc;
}

/* Rarity Styles */
.common { border-color: var(--common-color); box-shadow: 0 0 10px var(--common-color); }
.common .card-rarity { background: var