body {
    margin: 0;
    padding: 0;
    background-color: #111;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'Noto Sans TC', sans-serif;
    user-select: none;
}

#game-container {
    position: relative;
    width: 900px;
    background: #8cf; /* 天空藍 */
    border: 6px solid #444;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    overflow: hidden;
}

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

.base-health {
    position: absolute;
    top: 15px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 16px;
    pointer-events: auto;
    border: 2px solid #555;
}
.left-base { left: 15px; }
.right-base { right: 15px; text-align: right; }

.hp-bar {
    width: 140px; height: 10px; background: #333; margin-top: 6px; border-radius: 5px; overflow: hidden;
}
.hp-bar div { height: 100%; background: #0f0; transition: width 0.2s; }
.right-base .hp-bar div { background: #f33; float: right; }

.money-panel {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: gold;
    padding: 12px 25px;
    border-radius: 12px;
    font-weight: 900;
    font-size: 24px;
    text-align: center;
    pointer-events: auto;
    border: 2px solid #555;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

#btn-upgrade-wallet {
    margin-top: 8px; background: linear-gradient(180deg, #ffd700, #ff8c00); 
    border: none; padding: 6px 12px; border-radius: 6px;
    font-weight: 900; cursor: pointer; color: black; font-size: 14px; 
    transition: filter 0.2s, transform 0.1s;
}
#btn-upgrade-wallet:hover { filter: brightness(1.2); }
#btn-upgrade-wallet:active { transform: scale(0.95); }

canvas {
    display: block;
    image-rendering: auto;
    background: linear-gradient(to bottom, #87cefa 50%, #c1a87d 50%, #8b4513 100%);
}

#controls {
    display: flex; gap: 15px; padding: 15px; background: #222; border-top: 4px solid #111;
}

.unit-btn {
    position: relative;
    width: 90px; height: 110px;
    background: linear-gradient(135deg, #e0e0e0, #ffffff);
    border: 3px solid #666;
    border-radius: 10px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 6px 0 #888;
    transition: transform 0.1s, box-shadow 0.1s;
    overflow: hidden;
}
.unit-btn:hover { border-color: #333; }
.unit-btn:active { transform: translateY(6px); box-shadow: 0 0px 0 #888; border-color: transparent; }
.unit-btn.disabled { opacity: 0.6; filter: grayscale(1); cursor: not-allowed; pointer-events: none; }

.unit-icon { font-size: 38px; margin-bottom: 5px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)); }
.unit-name { font-size: 13px; font-weight: 900; color: #222; margin-bottom: 2px; }
.unit-cost { font-size: 15px; font-weight: 900; color: #d00; }

.cooldown-overlay {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 0%;
    background: rgba(0, 0, 0, 0.6); transition: height 0.1s linear; pointer-events: none;
}

#btn-cannon {
    background: linear-gradient(135deg, #222, #444);
    border-color: #000;
}
#btn-cannon .unit-name { color: #ff0; }
#btn-cannon .unit-cost { color: #fff; }

#game-over-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); color: white;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}
#game-over-screen h1 { font-size: 64px; margin-bottom: 30px; text-shadow: 0 0 30px rgba(255,255,255,0.8); }
#game-over-screen button {
    font-size: 24px; padding: 15px 40px; margin: 10px; cursor: pointer;
    background: #fff; border: none; border-radius: 50px; font-weight: 900; color: #333;
    transition: transform 0.2s, background 0.2s;
}
#game-over-screen button:hover { background: #ddd; transform: scale(1.05); }

.hidden { display: none !important; }
