body { margin: 0; background: #111; overflow: hidden; font-family: 'Arial Black', sans-serif; user-select: none; }
canvas { display: block; background: #000; cursor: crosshair; }

#ui-container { position: absolute; top: 20px; left: 20px; color: #fff; pointer-events: none; z-index: 10; }
.score-box { font-size: 32px; color: #0f0; text-shadow: 0 0 10px #0f0; font-style: italic; }
.coin-box { font-size: 24px; color: #ff0; text-shadow: 0 0 10px #ff0; font-style: italic; }
.stat-line { margin: 5px 0; font-size: 18px; color: #0ff; text-shadow: 0 0 5px #0ff; }
#class-list { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.badge { padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: bold; border: 2px solid #fff; text-transform: uppercase; background: #000; color: white; }
.evo-badge { background: #ff00ff; color: #fff; box-shadow: 0 0 15px #ff00ff; border-color: #fff; }

#shop-overlay { background: rgba(0,0,0,0.95); backdrop-filter: blur(15px); }
.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 20px; max-height: 500px; overflow-y: auto; padding: 20px; }
.skin-card { background: #050505; border: 2px solid #444; padding: 20px; border-radius: 15px; text-align: center; transition: 0.3s; }
.skin-card.owned { border-color: #0ff; }
.skin-card.equipped { border-color: #ff0; box-shadow: 0 0 20px #ff0; }
.skin-preview { width: 50px; height: 50px; margin: 0 auto 15px; border-radius: 50%; border: 3px solid #fff; }
.cost-tag { color: #ff0; font-weight: bold; margin-bottom: 10px; display: block; }

/* Crate Animation Styles */
#crate-overlay { background: rgba(0,0,0,0.95); display: none; flex-direction: column; justify-content: center; align-items: center; z-index: 2000; }
.crate-box { width: 150px; height: 150px; background: #855e42; position: relative; cursor: pointer; border: 6px solid #5d4037; box-shadow: 0 0 30px #ff0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.crate-box::after { content: ""; position: absolute; width: 100%; height: 20px; background: #5d4037; top: 50%; transform: translateY(-50%); }
.crate-box::before { content: ""; position: absolute; height: 100%; width: 20px; background: #5d4037; left: 50%; transform: translateX(-50%); }

/* Moon Crate Styles */
#moon-crate-overlay { background: rgba(0,0,0,0.95); display: none; flex-direction: column; justify-content: center; align-items: center; z-index: 2600; }
.moon-crate-box { width: 150px; height: 150px; background: #ccc; position: relative; cursor: pointer; border: 6px solid #999; box-shadow: 0 0 30px #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.moon-crate-box::after { content: ""; position: absolute; width: 100%; height: 20px; background: #999; top: 50%; transform: translateY(-50%); }
.moon-crate-box::before { content: ""; position: absolute; height: 100%; width: 20px; background: #999; left: 50%; transform: translateX(-50%); }
.moon-crate-box::after, .moon-crate-box::before { box-shadow: inset 0 0 5px rgba(0,0,0,0.2); }

.crate-shake { animation: shake 0.5s infinite; }
.crate-open { animation: explode 1s forwards; }
@keyframes shake {
    0% { transform: rotate(0deg); } 25% { transform: rotate(5deg); } 50% { transform: rotate(0eg); } 75% { transform: rotate(-5deg); } 100% { transform: rotate(0deg); }
}
@keyframes explode {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 1; filter: brightness(3); }
    100% { transform: scale(2); opacity: 0; }
}
.reveal-skin { font-size: 40px; color: #fff; text-align: center; opacity: 0; transform: scale(0.5); transition: 1s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.reveal-skin.show { opacity: 1; transform: scale(1); }

/* IMPROVED MOON EVENT CSS */
#moon-event-tab {
    position: fixed; top: 120px; left: 0; width: 50px; height: 160px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #483d8b; border-left: none;
    border-radius: 0 15px 15px 0; color: #fff;
    writing-mode: vertical-lr; text-align: center;
    font-size: 18px; cursor: pointer; transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1500; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 20px rgba(72, 61, 139, 0.5);
    text-transform: uppercase; letter-spacing: 2px; font-weight: bold;
}
#moon-event-tab:hover { background: #483d8b; width: 65px; box-shadow: 0 0 30px #483d8b; }

#moon-overlay {
    background: radial-gradient(circle at center, #0f0c29, #302b63, #24243e);
    display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 2500;
    overflow: hidden;
}
#moon-overlay::before {
    content: ""; position: absolute; width: 100%; height: 100%;
    background: url('https://www.transparenttextures.com/patterns/stardust.png');
    opacity: 0.3; pointer-events: none;
}

.moon-chest {
    width: 140px; height: 140px; background: #ccc; border: 4px solid #999;
    box-shadow: 0 0 40px #fff;
    margin: 30px; cursor: pointer; position: relative;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.moon-chest:hover { transform: scale(1.1) rotate(5deg); box-shadow: 0 0 60px #fff; }
.moon-chest::after {
    content: ""; position: absolute; width: 100%; height: 15px; background: #999; top: 50%; transform: translateY(-50%);
}
.moon-chest::before {
    content: ""; position: absolute; height: 100%; width: 15px; background: #999; left: 50%; transform: translateX(-50%);
}

.quest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; width: 80%; max-width: 800px; margin-top: 20px; }
.quest-card { background: rgba(255,255,255,0.1); border: 1px solid #aaa; padding: 15px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; color: #fff; }
.quest-progress { width: 100px; height: 10px; background: #444; border-radius: 5px; overflow: hidden; margin-top: 5px; }
.quest-bar { height: 100%; background: #0f0; width: 0%; transition: width 0.5s; }

#moon-timer { font-size: 32px; color: #ff4444; font-weight: bold; margin-bottom: 20px; text-shadow: 0 0 10px #f00; }
#moon-points-display { font-size: 24px; color: #aaa; margin-bottom: 10px; }

#boss-ui { position: absolute; bottom: 50px; left: 50%; transform: translateX(-50%); width: 600px; display: none; text-align: center; }
#boss-bar { width: 100%; height: 25px; background: #400; border: 3px solid #fff; border-radius: 5px; overflow: hidden; box-shadow: 0 0 20px #f00; }
#boss-fill { width: 100%; height: 100%; background: linear-gradient(90deg, #f00, #ff8800); transition: width 0.1s; }

#evo-popup {
    position: fixed; top: 30%; left: 50%; transform: translate(-50%, -50%);
    color: #fff; font-size: 50px; font-weight: 900; text-align: center;
    text-shadow: 0 0 30px #ff00ff, 0 0 50px #00ffff; pointer-events: none; opacity: 0; z-index: 2000;
    transition: 0.3s; font-style: italic;
}

.overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.9); backdrop-filter: blur(12px);
    display: none; flex-direction: column; justify-content: center; align-items: center; z-index: 1000;
}

.menu-card {
    background: #050505; border: 5px solid #0f0; padding: 40px; text-align: center;
    box-shadow: 0 0 60px #0f0; border-radius: 20px; width: 900px;
}

.game-title { font-size: 45px; color: #fff; margin: 0; text-shadow: 0 0 20px #0f0; font-style: italic; }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr; gap: 10px; margin-top: 20px; }
.admin-scroll { display: flex; flex-direction: column; gap: 5px; max-height: 250px; overflow-y: auto; padding-right: 5px; scrollbar-width: thin; scrollbar-color: #0f0 #000; }
.admin-scroll::-webkit-scrollbar { width: 4px; }
.admin-scroll::-webkit-scrollbar-thumb { background: #0f0; border-radius: 10px; }
.admin-section { border: 1px solid #444; padding: 10px; border-radius: 10px; background: #111; display: flex; flex-direction: column; }
.admin-section h3 { color: #aaa; margin-top: 0; font-size: 11px; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 10px; border-bottom: 1px solid #333; padding-bottom: 5px;}

.btn {
    background: #222; border: 2px solid #0f0; color: #0f0; padding: 10px;
    cursor: pointer; transition: 0.2s; text-transform: uppercase; font-weight: 900;
    margin: 3px; border-radius: 6px; font-size: 10px; width: calc(100% - 6px);
}
.btn:hover:not(:disabled) { background: #0f0; color: #000; box-shadow: 0 0 20px #0f0; transform: scale(1.02); }
.btn:disabled { border-color: #444; color: #444; cursor: not-allowed; }

.admin-field { background: #000; border: 1px solid #0f0; color: #0f0; width: 60px; padding: 5px; border-radius: 4px; font-family: monospace; font-size: 12px; outline: none; }

.btn-hero { border-color: #0ff; color: #0ff; }
.btn-evo { border-color: #f0f; color: #f0f; }
.btn-spawn { border-color: #ff4444; color: #ff4444; }
.btn-boss-spawn { border-color: #ff8800; color: #ff8800; font-size: 9px; }

.admin-input {
    background: #000; border: 2px solid #ff0; color: #ff0; padding: 15px;
    font-size: 20px; text-align: center; width: 80%; margin: 20px 0;
    font-family: monospace; outline: none; box-shadow: inset 0 0 10px #ff0;
}
#login-error { color: #f00; font-size: 12px; height: 15px; margin-bottom: 10px; visibility: hidden; }

#death-screen .menu-card { border-color: #f00; box-shadow: 0 0 60px #f00; }
#admin-panel .menu-card { border-color: #ff0; box-shadow: 0 0 40px #ff0; }

/* MULTIPLAYER UI */
#multiplayer-tab {
    position: fixed; top: 300px; left: 0; width: 50px; height: 160px;
    background: linear-gradient(180deg, #004400 0%, #002200 100%);
    border: 2px solid #0f0; border-left: none;
    border-radius: 0 15px 15px 0; color: #0f0;
    writing-mode: vertical-lr; text-align: center;
    font-size: 18px; cursor: pointer; transition: 0.4s;
    z-index: 1500; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
    text-transform: uppercase; letter-spacing: 2px; font-weight: bold;
}
#multiplayer-tab:hover { background: #006600; width: 65px; box-shadow: 0 0 30px #0f0; }

#multiplayer-overlay { background: rgba(0,0,0,0.95); backdrop-filter: blur(15px); }
.mp-container { width: 500px; text-align: center; }
.peer-id-box { background: #111; border: 1px solid #0f0; color: #0f0; padding: 10px; margin: 10px 0; font-family: monospace; font-size: 14px; word-break: break-all; transition: 0.3s; }
.peer-id-box:hover { background: #222; border-color: #fff; cursor: pointer; }

/* SLIDING UPGRADE MENU */
#sliding-upgrade-menu {
    position: fixed;
    top: -400px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    background: rgba(5, 5, 5, 0.95);
    border: 3px solid #0ff;
    border-top: none;
    border-radius: 0 0 20px 20px;
    padding: 20px;
    transition: top 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 5000;
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.5);
    color: #fff;
    text-align: center;
}
#sliding-upgrade-menu.active {
    top: 0;
}
#sliding-upgrade-menu h2 {
    margin: 0 0 15px 0;
    color: #0ff;
    text-shadow: 0 0 10px #0ff;
    font-style: italic;
    font-size: 24px;
}
#sliding-menu-options {
    display: flex;
    gap: 10px;
    justify-content: center;
}
#sliding-menu-options .btn {
    width: 180px;
    height: 80px;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-color: #0ff;
    color: #0ff;
}
#sliding-menu-options .btn:hover {
    background: #0ff;
    color: #000;
    box-shadow: 0 0 20px #0ff;
}

.spinner {
    border: 3px solid rgba(0, 255, 0, 0.1);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border-left-color: #0f0;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

