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

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

body {
    background: #0a0a0a;
    font-family: 'Press Start 2P', cursive;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#gameContainer {
    position: relative;
    background: linear-gradient(45deg, #1a1a2e 0%, #16213e 100%);
    border: 4px solid #00ff41;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.3),
                inset 0 0 40px rgba(0, 0, 0, 0.5);
}

canvas {
    display: block;
    background: #0f3460;
}

#ui {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #00ff41;
    font-size: 10px;
    text-shadow: 2px 2px 0 #000, 0 0 10px rgba(0, 255, 65, 0.5);
    pointer-events: none;
    z-index: 10;
}

#ui div {
    margin-bottom: 5px;
}

.bar {
    width: 150px;
    height: 12px;
    background: #000;
    border: 2px solid #00ff41;
    margin-top: 3px;
    position: relative;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff41 0%, #00cc33 100%);
    transition: width 0.2s;
}

.health-fill {
    background: linear-gradient(90deg, #ff0041 0%, #cc0033 100%);
}

#menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 4px solid #00ff41;
    padding: 30px;
    text-align: center;
    color: #00ff41;
    z-index: 100;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
}

#menu h1 {
    font-size: 16px;
    margin-bottom: 10px;
    text-shadow: 3px 3px 0 #000, 0 0 15px rgba(0, 255, 65, 0.8);
}

#menu h2 {
    font-size: 12px;
    margin-bottom: 20px;
    color: #ff0041;
    text-shadow: 2px 2px 0 #000;
}

#pauseBtn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #00ff41;
    color: #000;
    border: 2px solid #000;
    padding: 8px 16px;
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    cursor: pointer;
    z-index: 50;
    box-shadow: 3px 3px 0 #000;
}

#pauseBtn:hover {
    background: #00cc33;
}

#pauseMenu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.98);
    border: 4px solid #00ff41;
    padding: 40px;
    text-align: center;
    color: #00ff41;
    z-index: 150;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
}

.menu-btn {
    background: #00ff41;
    color: #000;
    border: none;
    padding: 12px 24px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
    margin: 10px;
    transition: all 0.2s;
    box-shadow: 4px 4px 0 #000;
}

.menu-btn:hover {
    background: #00cc33;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #000;
}

.menu-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #000;
}

#upgradeMenu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 760px;
    max-height: 92vh;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.96);
    border: 4px solid #00ff41;
    padding: 20px;
    text-align: center;
    color: #00ff41;
    z-index: 100;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
}

.upgrade-card.locked {
    opacity: 0.38;
    border-color: #555;
    cursor: not-allowed;
    filter: grayscale(1);
}

.upgrade-card.locked:hover {
    transform: none;
    box-shadow: none;
    background: #16213e;
}

.tree-tag {
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 6px;
    border: 1px solid #00ff41;
    color: #00ff41;
    font-size: 6px;
}

.lock-text {
    margin-top: 8px;
    color: #ff6b00;
    font-size: 6px;
    line-height: 1.4;
}

.lock-warning {
    margin-top: 6px;
    padding: 4px 6px;
    border: 1px dashed #ff6b00;
    color: #ff6b00;
    font-size: 6px;
    line-height: 1.4;
}

.lock-warning.danger {
    border-color: #ff0041;
    color: #ff0041;
    border-style: solid;
}

.lock-progress {
    margin-top: 6px;
    font-size: 6px;
    color: #9ca3af;
    line-height: 1.4;
}

#treeStatus {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 14px 0 6px 0;
    padding: 10px;
    border: 2px solid #1f4d7a;
    background: rgba(15, 52, 96, 0.4);
}

.tree-pill {
    font-size: 6px;
    padding: 4px 6px;
    border: 1px solid #00ff41;
    color: #00ff41;
    background: rgba(0,0,0,0.4);
    line-height: 1.4;
}

.tree-pill.chosen {
    border-color: #facc15;
    color: #facc15;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
}

.tree-pill.locked {
    border-color: #555;
    color: #666;
    text-decoration: line-through;
}

.tree-pill.warn {
    border-color: #ff6b00;
    color: #ff6b00;
}

.tree-pill .pill-count {
    color: #fff;
}

#specHint {
    font-size: 7px;
    margin: 8px auto 4px auto;
    color: #9ca3af;
    line-height: 1.5;
    max-width: 600px;
}

.upgrade-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.upgrade-card {
    background: #16213e;
    border: 3px solid #00ff41;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.upgrade-card:hover {
    border-color: #00cc33;
    background: #1a2642;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.4);
}

.upgrade-card h3 {
    font-size: 9px;
    margin-bottom: 8px;
    color: #ff0041;
}

.upgrade-card p {
    font-size: 7px;
    line-height: 1.4;
}

#leaderboardPanel, #leaderboardGameOver {
    margin-top: 18px;
    padding: 12px;
    border: 2px solid #1f4d7a;
    background: rgba(15, 52, 96, 0.45);
    color: #00ff41;
    font-size: 7px;
    line-height: 1.6;
    text-align: left;
}

#leaderboardPanel h3, #leaderboardGameOver h3 {
    color: #facc15;
    font-size: 8px;
    margin-bottom: 8px;
    text-align: center;
}

#scoreNameInput {
    width: 220px;
    padding: 8px;
    margin-top: 10px;
    background: #0f172a;
    border: 2px solid #00ff41;
    color: #00ff41;
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    text-align: center;
}

#upgradeTreePanel {
    margin: 12px 0;
    max-height: 170px;
    overflow-y: auto;
    padding: 8px;
    border: 2px solid #1f4d7a;
    background: rgba(15, 23, 42, 0.8);
    text-align: left;
}

.tree-block {
    margin-bottom: 8px;
    padding-bottom: 7px;
    border-bottom: 1px dashed #334155;
}

.tree-title {
    color: #facc15;
    font-size: 7px;
    margin-bottom: 5px;
}

.branch-line {
    font-size: 6px;
    line-height: 1.6;
    color: #9ca3af;
}

.node-owned { color: #00ff41; }
.node-open { color: #e5e7eb; }
.node-locked { color: #555; text-decoration: line-through; }
.branch-chosen { color: #38bdf8; }

.hidden {
    display: none !important;
}

#weaponMenu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 780px;
    max-height: 92vh;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.96);
    border: 4px solid #facc15;
    padding: 24px;
    text-align: center;
    color: #facc15;
    z-index: 120;
    box-shadow: 0 0 30px rgba(250,204,21,0.4);
}

.weapon-card {
    background: #16213e;
    border: 3px solid #facc15;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}
.weapon-card:hover {
    border-color: #fde047;
    background: #1f2e52;
    transform: scale(1.04);
    box-shadow: 0 0 18px rgba(250,204,21,0.4);
}
.weapon-card h3 { font-size: 9px; margin-bottom: 6px; color: #facc15; }
.weapon-card p  { font-size: 6px; line-height: 1.5; color: #d1d5db; }
.weapon-card .wtag { font-size: 6px; color: #9ca3af; margin-bottom: 6px; display:block; }



#gameOver {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 4px solid #ff0041;
    padding: 40px;
    text-align: center;
    color: #ff0041;
    z-index: 100;
    box-shadow: 0 0 30px rgba(255, 0, 65, 0.5);
}

#gameOver h1 {
    font-size: 20px;
    margin-bottom: 20px;
    text-shadow: 3px 3px 0 #000, 0 0 15px rgba(255, 0, 65, 0.8);
}
