@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #010205;
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    overflow: hidden;
}

#game-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #051433 0%, #010205 100%);
}

/* Hafifletilmiş CRT Efektleri */
#game-wrapper::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
    z-index: 100;
    background-size: 100% 4px;
    pointer-events: none;
}

#game-wrapper::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: radial-gradient(circle, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.3) 100%);
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.4);
    z-index: 101;
    pointer-events: none;
}

#game-container {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    background-color: transparent;
}

/* Glassmorphism Panel */
.glass-panel {
    background: rgba(10, 20, 40, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 255, 255, 0.1);
    animation: fadeIn 0.5s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.neon-text {
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
    margin: 0 0 10px 0;
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: 2px;
}

.neon-text.red {
    color: #ff0055;
    text-shadow: 0 0 10px #ff0055, 0 0 20px #ff0055;
}

.cyber-input {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #00ffff;
    color: #00ffff;
    padding: 15px 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    border-radius: 8px;
    outline: none;
    width: 100%;
    max-width: 300px;
    text-align: center;
    transition: all 0.3s ease;
}

.cyber-input:focus {
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    background: rgba(0, 255, 255, 0.1);
}

.cyber-btn {
    background: transparent;
    border: 2px solid #00ffff;
    color: #00ffff;
    padding: 15px 40px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.cyber-btn:hover {
    background: #00ffff;
    color: #000;
    box-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff;
    transform: translateY(-2px);
}

.fullscreen-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #0ff;
    color: #0ff;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    backdrop-filter: blur(5px);
    transition: 0.3s;
}

.fullscreen-btn:hover {
    background: #0ff;
    color: #000;
    box-shadow: 0 0 15px #0ff;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-text {
    color: #aaa;
    font-size: 1.1rem;
    margin-top: 10px;
    min-height: 1.5em;
    white-space: pre-wrap;
}

/* AŞAMA 5: TELSİZ İLETİŞİMİ CHAT PANELİ */

/* KRİTİK: Phaser wrapper - SADECE panel kapalıyken geçirgen, açıkken tıklamaları engellesin */
div:has(> #chatPanel:not(.open)) {
    pointer-events: none !important;
}

.chat-panel {
    width: 350px;
    height: 500px;
    background: rgba(0, 10, 20, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 255, 0.4);
    border-right: none;
    border-radius: 15px 0 0 15px;
    box-shadow: -5px 0 25px rgba(0, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    transform: translateX(350px);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: none;
    /* KRİTİK: Varsayılan olarak geçirgen, altındaki gridi engellemez */
}

.chat-panel.open {
    transform: translateX(0);
    pointer-events: auto;
    z-index: 9999;
    /* Açıkken etkileşime izin ver */
}

.chat-toggle-btn {
    position: absolute;
    top: 50%;
    left: -40px;
    width: 40px;
    height: 180px;
    transform: translateY(-50%);
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid rgba(0, 255, 255, 0.4);
    border-right: none;
    border-radius: 10px 0 0 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    color: #0ff;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 2px;
    transition: background 0.3s;
    box-shadow: -2px 0 15px rgba(0, 255, 255, 0.2);
    pointer-events: auto;
    /* Panel kapalı olsa bile butona tıklanabilmeli */
}

.chat-toggle-btn:hover {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
}

@keyframes blink-red {
    0% {
        background: rgba(0, 255, 255, 0.2);
        color: #00ffff;
        text-shadow: none;
        border-color: rgba(0, 255, 255, 0.4);
    }

    50% {
        background: #ff0055;
        color: #ffffff;
        text-shadow: 0 0 10px #ffffff;
        border-color: #ff0055;
    }

    100% {
        background: rgba(0, 255, 255, 0.2);
        color: #00ffff;
        text-shadow: none;
        border-color: rgba(0, 255, 255, 0.4);
    }
}

.chat-toggle-btn.has-new-message {
    animation: blink-red 1.2s infinite ease-in-out !important;
}

.chat-header {
    padding: 15px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    text-align: center;
    color: #0ff;
    font-weight: bold;
    letter-spacing: 1px;
    background: rgba(0, 255, 255, 0.05);
    border-radius: 15px 0 0 0;
}

.chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: #0ff transparent;
    pointer-events: auto;
    /* Kaydırma için aktif olmalı */
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #0ff;
    border-radius: 10px;
}

.chat-msg {
    padding: 10px 15px;
    border-radius: 8px;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
    font-family: inherit;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.msg-self {
    align-self: flex-end;
    background: rgba(0, 255, 255, 0.15);
    color: #fff;
    border-bottom-right-radius: 0;
    border: 1px solid rgba(0, 255, 255, 0.3);
}

.msg-enemy {
    align-self: flex-start;
    background: rgba(255, 0, 85, 0.15);
    color: #fff;
    border-bottom-left-radius: 0;
    border: 1px solid rgba(255, 0, 85, 0.3);
}

.msg-system {
    align-self: center;
    background: transparent;
    color: #ffd700;
    font-size: 12px;
    border: none;
    box-shadow: none;
    opacity: 0.8;
    text-align: center;
    padding: 5px;
}

.chat-input-area {
    display: flex;
    padding: 15px;
    border-top: 1px solid rgba(0, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
}

.chat-input {
    flex-grow: 1;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.3);
    color: #fff;
    padding: 10px;
    border-radius: 5px 0 0 5px;
    font-family: inherit;
    outline: none;
    pointer-events: auto;
    /* Yazı yazabilmek için aktif olmalı */
}

.chat-input:focus {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.chat-send-btn {
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-left: none;
    color: #0ff;
    padding: 0 15px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
    pointer-events: auto;
    /* Tıklanabilmesi için aktif olmalı */
}

.chat-send-btn:hover {
    background: #0ff;
    color: #000;
}

/* GLOBAL AYARLAR (AŞAMA 6) */
.settings-btn {
    position: absolute;
    top: 15px;
    left: 20px;
    z-index: 2000;
    padding: 10px 20px;
    background: rgba(0, 5, 20, 0.8);
    border: 1px solid rgba(0, 255, 255, 0.4);
    border-radius: 8px;
    color: #0ff;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.settings-btn:hover,
.settings-btn.active {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    color: #fff;
}

@media (max-width: 600px) {
    .settings-btn {
        font-size: 20px;
        padding: 8px 10px;
        letter-spacing: 0;
    }

    .settings-label {
        display: none;
    }
}

.settings-panel {
    position: absolute;
    top: 60px;
    left: 20px;
    z-index: 2000;
    width: 280px;
    background: rgba(0, 10, 20, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 255, 0.4);
    border-radius: 10px;
    padding: 20px;
    color: #0ff;
    font-family: 'Orbitron', sans-serif;
    box-shadow: 0 10px 30px rgba(0, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-panel h3 {
    margin: 0;
    text-align: center;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    padding-bottom: 10px;
    font-size: 16px;
    letter-spacing: 2px;
}

.setting-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
}

.setting-row input[type=range] {
    accent-color: #0ff;
    cursor: pointer;
    width: 100%;
}

/* YETENEK PANELİ (AŞAMA 9) */
.skills-bar {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    background: rgba(0, 10, 20, 0.6);
    backdrop-filter: blur(10px);
    padding: 8px 15px;
    border-radius: 50px;
    border: 1px solid rgba(0, 255, 255, 0.2);
    z-index: 1500;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(0, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.skill-btn {
    background: transparent;
    border: 1px solid rgba(0, 255, 255, 0.4);
    color: #0ff;
    padding: 8px 18px;
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.5;
    pointer-events: none;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.skill-btn.available {
    opacity: 1;
    pointer-events: auto;
    border-color: #0ff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.skill-btn.available:hover {
    background: rgba(0, 255, 255, 0.2);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
}

.skill-btn.active {
    background: #0ff !important;
    color: #000 !important;
    box-shadow: 0 0 20px #0ff !important;
    border-color: #fff;
    transform: scale(1.1);
}

.skill-btn.airstrike {
    border-color: rgba(255, 102, 0, 0.4);
    color: #ff6600;
}

.skill-btn.airstrike.available {
    border-color: #ff6600;
    box-shadow: 0 0 10px rgba(255, 102, 0, 0.3);
}

.skill-btn.airstrike.available:hover {
    background: rgba(255, 102, 0, 0.2);
    box-shadow: 0 0 15px rgba(255, 102, 0, 0.6);
}

.skill-btn.airstrike.active {
    background: #ff6600 !important;
    color: #fff !important;
    box-shadow: 0 0 20px #ff6600 !important;
}

.skill-badge {
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}