:root {
    --primary: #9d4edd;
    --secondary: #7b2cbf;
    --bg: #0d0914;
    --text: #f8f9fa;
    --border: 1px;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    overflow: hidden;
}

.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    padding: 10px 20px;
    border: 1px solid var(--primary);
    transition: 0.2s;
    z-index: 100;
}
.back-btn:hover {
    background: var(--primary);
}

#game-container {
    display: flex;
    border: 1px solid var(--secondary);
    background: #1a1525;
    position: relative;
}

.main-area {
    position: relative;
    background: #110d1a;
}

canvas {
    display: block;
    cursor: crosshair;
    max-width: 100%;
    height: auto;
    touch-action: none;
}

#hud {
    position: absolute;
    top: 10px;
    left: 20px;
    width: 660px;
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    pointer-events: none;
    z-index: 10;
}

.sidebar {
    width: 250px;
    background: #1a1525;
    border-left: 1px solid var(--secondary);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    color: var(--text);
}

.sidebar h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    border-bottom: 1px solid var(--secondary);
    padding-bottom: 10px;
    color: var(--primary);
}

.tower-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--secondary);
    padding: 10px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: 0.2s;
    text-align: left;
}
.tower-btn:hover {
    background: #2a223a;
}
.tower-btn.selected {
    background: var(--primary);
    color: var(--text);
    border-color: var(--primary);
}

.t-emoji { font-size: 1.5rem; }
.t-info { display: flex; flex-direction: column; }
.t-info strong { font-size: 1rem; font-weight: 700; }
.t-info span { font-weight: 400; color: #aaa; }

.status-msg {
    margin-top: auto;
    font-weight: 400;
    font-size: 0.9rem;
    background: #110d1a;
    padding: 10px;
    text-align: center;
    border: 1px solid var(--secondary);
}

.overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(13, 9, 20, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text);
    z-index: 50;
    cursor: pointer;
}

h1 {
    font-size: 3rem;
    color: var(--primary);
    line-height: 1.2;
    margin: 0 0 20px 0;
    font-weight: 900;
    letter-spacing: 2px;
}
p {
    font-size: 1.2rem;
    font-weight: 400;
    margin: 0 0 20px 0;
    color: #ccc;
}
.instructions {
    font-size: 1rem;
    font-weight: 700;
    background: var(--secondary);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 4px;
}

@media (max-width: 768px) {
    #game-container {
        flex-direction: column;
        width: 100%;
    }
    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--secondary);
        box-sizing: border-box;
    }
    #hud {
        width: calc(100% - 40px);
        font-size: 1rem;
    }
    h1 {
        font-size: 2.5rem;
    }
}
