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

:root {
    --bg: #0a0a12;
    --fg: #e8e8f0;
    --accent: #00ffaa;
    --danger: #ff4466;
    --warning: #ffaa00;
    --card: #161622;
    --border: #2a2a3a;
    --muted: #6a6a7a;
    --gold: #ffd700;
    --armor: #4488ff;
    --skill1: #ff44ff;
    --skill2: #44ffff;
    --skill3: #ffaa44;
    --arrow: #88ff44;
}

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

body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'JetBrains Mono', monospace;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gameContainer {
    position: relative;
    border: 4px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 0 40px rgba(0, 255, 170, 0.15);
}

#gameCanvas {
    display: block;
    image-rendering: pixelated;
    cursor: crosshair;
}

#ui {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 10;
}

.stat-box {
    background: rgba(10, 10, 18, 0.9);
    border: 2px solid var(--border);
    padding: 8px 12px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bar-container { display: flex; align-items: center; gap: 6px; }
.bar-label { font-family: 'Press Start 2P', cursive; font-size: 7px; width: 24px; }
.bar-bg { width: 100px; height: 10px; background: var(--card); border: 2px solid var(--border); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; transition: width 0.3s ease; }
.hp-fill { background: linear-gradient(90deg, var(--danger), #ff6688); }
.armor-fill { background: linear-gradient(90deg, var(--armor), #66aaff); }

.resource-row { display: flex; gap: 12px; align-items: center; }

.gold-display, .arrow-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
}
.gold-display { color: var(--gold); }
.arrow-display { color: var(--arrow); }

.room-counter { font-family: 'Press Start 2P', cursive; font-size: 9px; color: var(--accent); }
.room-counter span { color: var(--warning); }
.right-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.shop-btn {
    font-family: 'Press Start 2P', cursive; font-size: 8px; padding: 8px 12px;
    background: rgba(255, 215, 0, 0.2); border: 2px solid var(--gold); color: var(--gold);
    cursor: pointer; pointer-events: all; transition: all 0.2s;
}
.shop-btn:hover { background: var(--gold); color: var(--bg); }

#skillBar {
    position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 8px; z-index: 10; pointer-events: none;
}

.skill-slot {
    width: 50px; height: 50px;
    background: rgba(10, 10, 18, 0.9);
    border: 2px solid var(--border); border-radius: 4px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}

.skill-icon { font-family: 'Press Start 2P', cursive; font-size: 8px; color: var(--fg); z-index: 2; position: relative; }
.skill-key { position: absolute; top: 2px; left: 4px; font-family: 'Press Start 2P', cursive; font-size: 6px; color: var(--muted); z-index: 3; }
.skill-alt { position: absolute; top: 2px; right: 4px; font-family: 'Press Start 2P', cursive; font-size: 6px; color: var(--muted); z-index: 3; }

/* Cooldown Bar Animation */
.cooldown-bar-container {
    position: absolute; bottom: 4px; left: 6px; right: 6px;
    height: 6px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 3px;
    overflow: hidden;
    z-index: 1;
}

.cooldown-bar-fill {
    width: 100%;
    height: 100%;
    border-radius: 3px;
    transition: width 0.1s linear;
}

.skill1 .cooldown-bar-fill { background: linear-gradient(90deg, #ff44ff, #ff88ff); }
.skill2 .cooldown-bar-fill { background: linear-gradient(90deg, #44ffff, #88ffff); }
.skill3 .cooldown-bar-fill { background: linear-gradient(90deg, #ffaa44, #ffcc88); }

.cooldown-text {
    position: absolute;
    font-family: 'Press Start 2P', cursive; font-size: 10px; color: #fff;
    z-index: 3; text-shadow: 1px 1px 2px #000;
}

.skill-slot.skill1 { border-color: var(--skill1); }
.skill-slot.skill2 { border-color: var(--skill2); }
.skill-slot.skill3 { border-color: var(--skill3); }

#shopModal {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none; align-items: center; justify-content: center; z-index: 200;
}

.shop-panel { background: var(--card); border: 3px solid var(--gold); border-radius: 8px; padding: 20px; min-width: 280px; }
.shop-title { font-family: 'Press Start 2P', cursive; font-size: 14px; color: var(--gold); text-align: center; margin-bottom: 16px; }

.shop-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px; margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.3); border: 2px solid var(--border); border-radius: 4px;
    cursor: pointer; transition: all 0.2s;
}
.shop-item:hover { border-color: var(--accent); background: rgba(0, 255, 170, 0.1); }
.shop-item.disabled { opacity: 0.5; cursor: not-allowed; }
.item-info { display: flex; flex-direction: column; gap: 4px; }
.item-name { font-family: 'Press Start 2P', cursive; font-size: 9px; color: var(--fg); }
.item-desc { font-size: 9px; color: var(--muted); }
.item-price { font-family: 'Press Start 2P', cursive; font-size: 9px; color: var(--gold); }

.close-shop {
    font-family: 'Press Start 2P', cursive; font-size: 10px; padding: 10px 20px;
    background: transparent; border: 2px solid var(--danger); color: var(--danger);
    cursor: pointer; width: 100%; margin-top: 12px;
}
.close-shop:hover { background: var(--danger); color: var(--bg); }

#startScreen, #gameOverScreen {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 10, 18, 0.95);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 100; gap: 20px;
}
#gameOverScreen { display: none; }

.title { font-family: 'Press Start 2P', cursive; font-size: 22px; color: var(--accent); text-align: center; line-height: 1.6; }
.btn { font-family: 'Press Start 2P', cursive; font-size: 11px; padding: 14px 28px; background: transparent; border: 3px solid var(--accent); color: var(--accent); cursor: pointer; }
.btn:hover { background: var(--accent); color: var(--bg); }

.controls-info { font-size: 9px; color: var(--muted); text-align: center; line-height: 2; }
.controls-info kbd { background: var(--card); padding: 3px 6px; border-radius: 3px; border: 1px solid var(--border); color: var(--fg); }
.final-score { font-family: 'Press Start 2P', cursive; font-size: 12px; color: var(--warning); }
