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

body {
    background: #0a0e17;
    color: #e0e0e0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    max-width: 1320px;
    padding: 8px;
}

/* TOP BAR */
#top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 16px;
    background: linear-gradient(180deg, #141b2d 0%, #0d1220 100%);
    border: 1px solid #1e2a42;
    border-radius: 12px;
}

.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 180px;
}

.player-info .label {
    font-size: 11px;
    letter-spacing: 2px;
    color: #6b7fa3;
    font-weight: 600;
}

.base-hp {
    font-size: 20px;
    font-weight: 700;
}

#player-hp { color: #3498db; }
#enemy-hp { color: #e74c3c; }

.game-title {
    text-align: center;
}

.game-title h1 {
    font-size: 24px;
    letter-spacing: 8px;
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
}

.resource-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

#player-gold {
    font-size: 18px;
    font-weight: 700;
    color: #f1c40f;
}

.regen-rate {
    font-size: 12px;
    color: #7f8c8d;
}

/* CANVAS */
#game-canvas {
    border-radius: 8px;
    border: 1px solid #1e2a42;
    cursor: crosshair;
    background: #0f1923;
}

/* BOTTOM BAR */
#bottom-bar {
    display: flex;
    gap: 12px;
    width: 100%;
}

.panel {
    flex: 1;
    background: linear-gradient(180deg, #141b2d 0%, #0d1220 100%);
    border: 1px solid #1e2a42;
    border-radius: 12px;
    padding: 8px 12px;
}

.panel-label {
    display: block;
    font-size: 10px;
    letter-spacing: 1.5px;
    color: #4a5f82;
    margin-bottom: 6px;
    font-weight: 600;
}

.btn-row {
    display: flex;
    gap: 8px;
}

.game-btn {
    background: linear-gradient(180deg, #1a2744 0%, #131d30 100%);
    border: 1px solid #2a3a5c;
    color: #c8d6e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.game-btn:hover {
    background: linear-gradient(180deg, #243556 0%, #1a2744 100%);
    border-color: #3d5a8a;
    transform: translateY(-1px);
}

.game-btn:active {
    transform: translateY(0);
}

.game-btn.active {
    border-color: #f1c40f;
    box-shadow: 0 0 12px rgba(241, 196, 15, 0.3);
}

.game-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.tower-btn, .troop-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
}

.btn-icon {
    font-size: 22px;
}

.btn-name {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.btn-cost {
    font-size: 11px;
    color: #f1c40f;
    font-weight: 700;
}

/* OVERLAYS */
.hidden { display: none !important; }

#overlay, #start-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 15, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.overlay-content {
    background: linear-gradient(180deg, #1a2440 0%, #111827 100%);
    border: 1px solid #2a3a5c;
    border-radius: 16px;
    padding: 32px 48px;
    text-align: center;
    max-width: 420px;
}

.overlay-content h2 {
    font-size: 28px;
    margin-bottom: 8px;
    letter-spacing: 4px;
}

.overlay-content p {
    color: #8899aa;
    margin-bottom: 16px;
    font-size: 14px;
}

.rules {
    text-align: left;
    list-style: none;
    margin-bottom: 20px;
}

.rules li {
    padding: 4px 0;
    font-size: 13px;
    color: #8899aa;
}

.rules li::before {
    content: '▸ ';
    color: #f1c40f;
}

.game-btn--big {
    padding: 12px 40px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 3px;
    background: linear-gradient(180deg, #d4a20a 0%, #b8860b 100%);
    color: #0a0e17;
    border-color: #f1c40f;
}

.game-btn--big:hover {
    background: linear-gradient(180deg, #f1c40f 0%, #d4a20a 100%);
}

/* UPGRADE PANEL */
#upgrade-panel {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
}

.upgrade-content {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #1a2744 0%, #111827 100%);
    border: 1px solid #2a3a5c;
    border-radius: 10px;
    padding: 8px 12px;
}

#upgrade-info {
    font-size: 12px;
    color: #8899aa;
    min-width: 120px;
}

.game-btn--small {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
}

.game-btn--sell {
    border-color: #e74c3c;
    color: #e74c3c;
}

.game-btn--close {
    border-color: #555;
    color: #888;
    padding: 6px 8px;
}

/* TOOLTIP */
#tooltip {
    position: fixed;
    background: #1a2744;
    border: 1px solid #2a3a5c;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: #c8d6e5;
    pointer-events: none;
    z-index: 200;
    max-width: 200px;
    line-height: 1.4;
}

/* Responsive */
@media (max-width: 1100px) {
    #game-canvas {
        width: 100% !important;
        height: auto !important;
    }
}
