:root {
    --bg-color: #0a0a12;
    --primary: #00f3ff;
    --secondary: #bc13fe;
    --accent: #ffe600;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
    --font: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text);
    font-family: var(--font);
    overflow: auto;
    min-height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
    width: 1200px;
    height: 800px;
    flex-shrink: 0; /* Prevent shrinking */
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    background: #000; /* Fallback */
}

canvas {
    background: radial-gradient(circle at center, #1a1a2e 0%, #0a0a12 100%);
    width: 100%;
    height: 100%;
    display: block;
}

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

#top-bar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    pointer-events: auto;
}

.stat-box {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 10px 25px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.stat-box .label {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.6);
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.stat-box .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

#bottom-bar {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;
    align-items: flex-end;
    pointer-events: auto;
}

.tower-selector {
    display: flex;
    gap: 15px;
    background: var(--glass);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.tower-card {
    width: 80px;
    height: 100px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.tower-card:hover {
    background: rgba(255,255,255,0.08);
    transform: translateY(-5px);
}

.tower-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
    background: rgba(0, 243, 255, 0.1);
}

.tower-card .icon {
    width: 50px;
    height: 50px;
    margin-bottom: 8px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.3));
}

.basic-icon { background-image: url('assets/tower_basic.png'); }
.rapid-icon { background-image: url('assets/tower_rapid.png'); }
.sniper-icon { background-image: url('assets/tower_sniper.png'); }
.ice-icon { background-image: url('assets/tower_ice.png'); }
.missile-icon { background-image: url('assets/tower_missile.png'); }
.laser-icon { background-image: url('assets/tower_laser.png'); }

.tower-card .info {
    text-align: center;
}

.tower-card .name {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
}

.tower-card .cost {
    display: block;
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 700;
}

.action-btn {
    background: linear-gradient(45deg, var(--primary), #00a8ff);
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    color: #000;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
    height: 60px;
}

.action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.6);
}

.action-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.secondary-btn {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

.secondary-btn:hover {
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    pointer-events: auto;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid var(--primary);
    padding: 40px;
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.2);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 2rem;
    color: var(--text);
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--primary);
}

.modal-content h2 {
    color: var(--primary);
    margin-bottom: 30px;
    text-align: center;
    font-size: 2rem;
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.guide-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.guide-image {
    width: 50%;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}

.guide-text {
    width: 50%;
}

.guide-text h3 {
    color: var(--accent);
    margin-bottom: 10px;
    margin-top: 20px;
}

.guide-text h3:first-child {
    margin-top: 0;
}

.guide-text p {
    color: #ccc;
    line-height: 1.6;
}

#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    pointer-events: auto;
}

#game-over-screen.hidden {
    display: none;
}

#game-over-screen h1 {
    font-size: 4rem;
    color: #ff0055;
    text-shadow: 0 0 20px rgba(255, 0, 85, 0.6);
    margin-bottom: 20px;
}

#game-over-screen p {
    font-size: 1.5rem;
    margin-bottom: 40px;
}

.restart-btn {
    background: transparent;
    border: 2px solid var(--text);
    color: var(--text);
    padding: 15px 50px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
}

.restart-btn:hover {
    background: var(--text);
    color: #000;
    box-shadow: 0 0 20px rgba(255,255,255,0.4);
}
