/* --- GENEL AYARLAR --- */
body {
    margin: 0; padding: 0;
    background-color: #000;
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    overflow: hidden; touch-action: none; user-select: none;
}

#gameCanvas { display: block; width: 100%; height: 100%; }

/* SOL ÜST ÇIKIŞ LİNKİ */
/* GÜNCELLEME: Z-Index 201 yapıldı (Menü üzerinde görünsün diye) */
.back-link {
    position: absolute; top: 15px; left: 15px;
    color: #00eaff; text-decoration: none; font-weight: bold; 
    z-index: 201; /* Overlay (200) üstüne çıkarıldı */
    text-shadow: 0 0 5px #00eaff; font-size: 0.8rem;
    background: rgba(0,0,0,0.6); padding: 5px 10px; border-radius: 5px;
    border: 1px solid #333;
}

/* HIGH SCORE KUTUSU */
.highscore-box {
    position: absolute; top: 15px; left: 90px; 
    font-size: 0.7rem; color: #aaa; background: rgba(0,0,0,0.6);
    padding: 8px; border-radius: 5px; border: 1px solid #333; z-index: 55;
}
#highScoreVal { color: #fff; font-weight: bold; }

/* SAĞ ÜST KONTROLLER */
/* GÜNCELLEME: Z-Index 201 yapıldı */
.top-controls {
    position: absolute; top: 15px; right: 15px; 
    z-index: 201; /* Overlay (200) üstüne çıkarıldı */
    display: flex; gap: 8px; align-items: center;
    background: rgba(0, 0, 0, 0.4); padding: 5px; border-radius: 10px;
}

/* Ayırıcı Çizgi */
.separator { width: 1px; height: 30px; background: rgba(255,255,255,0.2); margin: 0 5px; }

/* Küçük Sistem Butonları (Pause/Ses/Tam Ekran) */
.icon-btn {
    background: rgba(0,0,0,0.6); border: 1px solid #555; color: #aaa;
    width: 35px; height: 35px; border-radius: 5px; cursor: pointer;
    font-size: 1rem; display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.icon-btn:hover { background: #333; color: #fff; }
.icon-btn.muted { color: #555; border-color: #333; }

/* Aksiyon Butonları (Market) - PC'DE GİZLİ, MOBİLDE AÇIK */
.top-controls .action-btn, .top-controls .separator {
    display: none; 
}

/* Buton Tasarımı */
.action-btn {
    width: 45px; height: 45px; border-radius: 8px; border: 2px solid #fff;
    color: #fff; background: rgba(0,0,0,0.5); font-size: 1.2rem;
    padding: 0; display: flex; justify-content: center; align-items: center;
    cursor: pointer; box-shadow: 0 0 5px rgba(0,0,0,0.5); transition: transform 0.1s;
}
.action-btn:active { transform: scale(0.95); }

/* Renkler */
.gold-btn { border-color: #ffd700; color: #ffd700; box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
.green-btn { border-color: #00ff00; color: #00ff00; box-shadow: 0 0 10px rgba(0, 255, 0, 0.3); }
.red-btn { border-color: #ff0000; color: #ff0000; box-shadow: 0 0 10px rgba(255, 0, 0, 0.3); }
.purple-btn { border-color: #aa00ff; color: #aa00ff; box-shadow: 0 0 10px rgba(170, 0, 255, 0.3); }

/* ORTA PANEL (SKOR VE PARA) */
.center-panel {
    position: absolute; top: 15px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 20px; align-items: center;
    background: rgba(0, 0, 0, 0.7); padding: 5px 20px; border-radius: 10px;
    border: 1px solid rgba(0, 234, 255, 0.3); z-index: 55;
}

.score-box { font-size: 1rem; color: #00eaff; text-shadow: 0 0 10px rgba(0, 234, 255, 0.6); }
.money-box { 
    font-size: 0.9rem; color: #ffd700; 
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    transition: transform 0.2s, color 0.2s; 
}

/* MARKET İPUÇLARI - PC'DE ALTTA */
.shop-hint {
    position: absolute; 
    bottom: 40px; 
    top: auto;    
    left: 50%; transform: translateX(-50%);
    font-size: 0.65rem; color: #aaa; background: rgba(0,0,0,0.7);
    padding: 8px 20px; border-radius: 15px; border: 1px solid #333;
    text-align: center; white-space: nowrap; z-index: 50;
    width: auto; max-width: 90%; 
}

/* DALGA GÖSTERGESİ */
.wave-indicator {
    position: absolute; top: 80px; left: 50%; transform: translateX(-50%);
    font-size: 1.2rem; color: rgba(255, 255, 255, 0.3); letter-spacing: 3px;
    pointer-events: none; text-shadow: 0 0 5px rgba(255,255,255,0.1);
    transition: all 0.3s; z-index: 40; font-weight: bold;
}
.wave-update {
    color: #ff0055; top: 50%; transform: translate(-50%, -50%) scale(2.5); 
    opacity: 1; text-shadow: 0 0 30px #ff0055;
}

#nuke-flash {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: white; opacity: 0; pointer-events: none; z-index: 20;
    transition: opacity 0.1s;
}
.flash-active { animation: flashAnim 1s forwards; }
@keyframes flashAnim { 0% { opacity: 1; } 100% { opacity: 0; } }

#ui-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 10;
}

#pause-overlay {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    text-align: center; background: rgba(0,0,0,0.85); padding: 20px 40px;
    border: 2px solid #00eaff; border-radius: 10px;
    box-shadow: 0 0 20px #00eaff; z-index: 100;
}
#pause-overlay h2 { color: #00eaff; margin: 0 0 10px 0; letter-spacing: 2px; }
#pause-overlay p { color: #fff; margin: 0; font-size: 0.9rem; }

.health-container { position: absolute; bottom: 20px; left: 20px; display: flex; flex-direction: column; gap: 10px; width: 200px; }
.health-container-p2 { position: absolute; bottom: 20px; right: 140px; display: flex; flex-direction: column; gap: 10px; width: 200px; align-items: flex-end; }

.p1-health, .p2-health { display: flex; align-items: center; gap: 10px; font-size: 0.7rem; color: #aaa; width: 100%; }
.bar-bg { flex-grow: 1; height: 8px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.3); transform: skewX(-20deg); }
.bar-fill { width: 100%; height: 100%; background: #00eaff; box-shadow: 0 0 10px #00eaff; transition: width 0.2s; }
#hp-p2 { background: #ff0055; box-shadow: 0 0 10px #ff0055; }

.minimap-container {
    position: absolute; bottom: 20px; right: 20px;
    border: 2px solid rgba(0, 234, 255, 0.3); background: rgba(0,0,0,0.5);
    width: 100px; height: 100px; border-radius: 50%; overflow: hidden;
}

#overlay, #game-over-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 5, 0.95);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 200; /* Menü katmanı */
}

h1 { font-size: 3rem; margin: 0; color: #fff; text-shadow: 0 0 20px #00eaff; letter-spacing: 5px; }
.subtitle { color: #888; letter-spacing: 3px; font-size: 0.9rem; margin-bottom: 30px; }

.controls-info {
    display: flex; gap: 30px; margin-bottom: 40px;
    font-family: sans-serif; font-size: 0.8rem; color: #aaa; text-align: center;
}
.info-group { background: rgba(255,255,255,0.05); padding: 15px; border-radius: 10px; border: 1px solid #333; }
.highlight { color: #00eaff; font-weight: bold; display: block; margin-bottom: 5px; }

button {
    background: transparent; color: #00eaff; border: 2px solid #00eaff;
    padding: 15px 40px; font-family: 'Orbitron'; font-size: 1rem; cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 234, 255, 0.2); transition: 0.2s;
}
button:hover { background: #00eaff; color: #000; box-shadow: 0 0 40px #00eaff; transform: scale(1.05); }
.btn-group { display: flex; gap: 20px; }

/* MOBİL KONTROLLER - Sadece Joystick */
#mobile-controls {
    position: absolute; bottom: 20px; width: 100%;
    display: none; justify-content: space-between; padding: 0 30px;
    z-index: 50; box-sizing: border-box; pointer-events: none;
}
.joystick-area { width: 100px; height: 100px; position: relative; pointer-events: auto; }
.stick-base {
    width: 100%; height: 100%; background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1); border-radius: 50%; position: relative;
}
.stick-handle {
    width: 40px; height: 40px; background: rgba(0, 234, 255, 0.5);
    border-radius: 50%; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); box-shadow: 0 0 15px #00eaff;
}

/* --- MOBİL UYUMLULUK (Max Width 900px) --- */
@media (max-width: 900px) {
    #mobile-controls { display: flex; }
    .controls-info { display: none; }
    h1 { font-size: 2rem; }
    
    /* MOBİLDE MARKET BUTONLARINI GÖSTER */
    .top-controls .action-btn, .top-controls .separator {
        display: flex;
    }
    .action-btn { width: 40px; height: 40px; }
    
    /* MOBİLDE YAZILI İPUCUNU GİZLE */
    .shop-hint { display: none; } 
    
    .center-panel { top: 10px; left: 10px; transform: none; width: auto; font-size: 0.8rem; padding: 5px 10px; }
    .score-box, .money-box { font-size: 0.8rem; }
    .highscore-box { display: none; }
    .back-link { display: none; } 
    
    .minimap-container { top: 70px; right: 10px; bottom: auto; width: 60px; height: 60px; }
    
    .health-container { bottom: 130px; left: 10px; width: 120px; }
    .health-container-p2 { top: 140px; right: 10px; width: 120px; bottom: auto; }
}