@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Roboto:wght@400;700&display=swap');

:root {
    --bg-color: #050505;
    --ui-bg: rgba(20, 20, 20, 0.95);
    --ui-border: #5c4d35;
    --accent: #d4af37;
    --hp-color: #b91c1c;
    --mp-color: #1d4ed8;
    --xp-color: #10b981;
    --rare-blue: #3b82f6;
    --rare-purple: #8b5cf6;
    --rare-orange: #f97316;
}

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

body {
    overflow: hidden;
    background-color: var(--bg-color);
    color: #eee;
    font-family: 'Roboto', sans-serif;
}

canvas { display: block; position: absolute; top: 0; left: 0; }
#game-canvas { z-index: 1; }
#lighting-canvas { z-index: 2; pointer-events: none; }

#ui-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10;
    pointer-events: none;
    display: none;
}

.pointer-events-auto { pointer-events: auto; }

/* HUD */
#hud {
    position: absolute;
    top: 10px; left: 10px;
    width: 280px;
    background: var(--ui-bg);
    border: 2px solid var(--ui-border);
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 0 10px #000;
}

.bar-container {
    background: #333;
    height: 12px;
    width: 100%;
    margin-bottom: 4px;
    border: 1px solid #000;
    position: relative;
}

.bar-fill { height: 100%; transition: width 0.2s; }
#hp-bar { background-color: var(--hp-color); }
#mp-bar { background-color: var(--mp-color); }
#xp-bar { background-color: var(--xp-color); height: 6px; margin-top: 5px; }

.stats-text {
    display: flex; justify-content: space-between;
    font-size: 0.75rem; color: #ccc; margin-top: 5px;
}

.gold-text { color: gold; font-weight: bold; }

/* Skill Bar */
#skill-bar {
    position: absolute;
    bottom: 20px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 10px;
    background: rgba(0,0,0,0.8);
    padding: 5px; border-radius: 5px;
    border: 1px solid #444;
}

.skill-slot {
    width: 50px; height: 50px;
    background: #222; border: 2px solid #555;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    font-family: 'Press Start 2P'; font-size: 0.6rem;
    position: relative; cursor: pointer;
}

.skill-slot:hover { border-color: var(--accent); }

.skill-key { position: absolute; top: 2px; left: 4px; color: #888; font-size: 0.5rem; }

.skill-cooldown {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; color: white; display: none;
}

/* Inventory */
#inventory-panel {
    position: absolute;
    top: 10px; right: 10px;
    width: 200px;
    background: var(--ui-bg);
    border: 2px solid var(--ui-border);
    padding: 10px;
    max-height: 90vh;
    overflow-y: auto;
}

.inv-slot {
    background: #111;
    border: 1px solid #333;
    height: 40px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    padding: 0 5px;
    cursor: pointer;
    font-size: 0.8rem;
    justify-content: space-between;
}

.inv-slot:hover { border-color: var(--accent); }

.rarity-common { color: #fff; }
.rarity-rare { color: var(--rare-blue); border-color: var(--rare-blue); }
.rarity-legendary { color: var(--rare-orange); border-color: var(--rare-orange); box-shadow: 0 0 5px var(--rare-orange); }

/* Modals */
.modal {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 100;
}

h1 { font-family: 'Press Start 2P'; color: var(--accent); text-shadow: 3px 3px #800000; text-align: center; line-height: 1.5; }

input, button {
    background: #222; color: white; border: 2px solid var(--accent);
    padding: 10px 20px; font-family: 'Press Start 2P'; font-size: 0.8rem; margin: 10px; cursor: pointer;
}

input { width: 250px; font-family: 'Roboto', sans-serif; font-size: 0.9rem; }
input:focus { outline: none; border-color: #fff; }

button:hover { background: #333; transform: scale(1.05); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.stat-btn {
    width: 200px; display: flex; justify-content: space-between; margin: 5px;
}

/* Toast Notifications */
#toast-area {
    position: absolute; bottom: 100px; right: 20px;
    display: flex; flex-direction: column; align-items: flex-end;
}

.toast {
    background: rgba(0,0,0,0.8); border-left: 4px solid var(--accent);
    padding: 8px 15px; margin-bottom: 5px; animation: fadeUp 2s forwards;
    font-size: 0.8rem;
}

@keyframes fadeUp {
    0% { opacity:0; transform:translateY(10px); }
    10% { opacity:1; }
    90% { opacity:1; }
    100% { opacity:0; }
}

/* Auth tabs */
.auth-tab.active { background: #333 !important; color: gold !important; border-color: var(--accent) !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }