body { 
    margin: 0; 
    overflow: hidden; 
    background-color: #0b0c10; 
    color: #66fcf1; 
    font-family: 'Courier New', Courier, monospace; 
    user-select: none;
    touch-action: none;
}
canvas { display: block; touch-action: none; }

#ui { 
    position: absolute; top: 15px; left: 15px; font-size: 20px; 
    font-weight: bold; z-index: 10; text-shadow: 0 0 5px #45a29e, 0 0 10px #45a29e;
    pointer-events: none;
}

#bossWarning {
    display: none; position: absolute; top: 20%; left: 50%;
    transform: translate(-50%, -50%); font-size: clamp(30px, 6vw, 50px); color: #ff003c;
    text-shadow: 0 0 20px #ff003c, 0 0 40px #ff0000; z-index: 15;
    animation: blink 0.5s infinite; white-space: nowrap; width: 100%; text-align: center;
    pointer-events: none;
}
@keyframes blink { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }

#levelUpScreen, #gameOverScreen, #pauseScreen { 
    display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(11, 12, 16, 0.9); z-index: 20; flex-direction: column; 
    align-items: center; justify-content: center; 
}
#pauseScreen { z-index: 50; }

.top-controls { 
    position: absolute; top: 15px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; justify-content: center; gap: 10px; z-index: 100; 
    background: rgba(11, 12, 16, 0.95); padding: 8px 15px; border-radius: 12px;
    border: 1px solid #45a29e; box-shadow: 0 0 15px rgba(69, 162, 158, 0.3);
    width: max-content; max-width: 90vw; flex-wrap: wrap;
}
.top-btn {
    background: #1f2833; color: #66fcf1; border: 2px solid #45a29e;
    padding: 8px 15px; font-size: clamp(12px, 3vw, 16px); font-family: 'Courier New', Courier, monospace; font-weight: bold;
    border-radius: 8px; cursor: pointer; transition: 0.2s; white-space: nowrap;
}
.top-btn:hover { background: #45a29e; color: #0b0c10; box-shadow: 0 0 15px #66fcf1; }

input[type=range] { -webkit-appearance: none; width: clamp(80px, 15vw, 120px); background: transparent; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; height: 20px; width: 10px; background: #66fcf1;
    cursor: pointer; box-shadow: 0 0 10px #66fcf1; border-radius: 3px; margin-top: -8px;
}
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; cursor: pointer; background: #45a29e; border-radius: 2px; }

#levelUpTitle, #pauseScreen h1, #gameOverScreen h1 { 
    font-size: clamp(28px, 6vw, 45px); text-shadow: 0 0 20px currentColor; 
    margin-top: 80px; margin-bottom: 5px; text-align: center; padding: 0 10px; color: #66fcf1;
}
#gameOverScreen h1 { color: #ff003c; }
#levelUpSubtitle { color: #c5c6c7; font-size: clamp(14px, 4vw, 18px); margin-bottom: 15px; text-align: center; }
#pauseScreen p, #roastText { font-size: clamp(14px, 4vw, 20px); color: #c5c6c7; text-align: center; padding: 0 10px; margin-bottom: 15px; }

.card-container { 
    display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; 
    width: 100%; max-width: 900px; padding: 0 15px; box-sizing: border-box; 
}
.card { 
    position: relative; background: #1f2833; border: 2px solid #45a29e; box-shadow: 0 0 10px rgba(69, 162, 158, 0.5);
    padding: 15px; border-radius: 12px; cursor: pointer; text-align: center; 
    width: 240px; box-sizing: border-box; transition: all 0.2s ease;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.card:hover, .card.highlight { 
    border-color: #66fcf1; background: #2a3642; transform: scale(1.05) translateY(-5px); box-shadow: 0 0 20px rgba(102, 252, 241, 0.8);
}
.rank-badge {
    position: absolute; top: -10px; right: -10px; background-color: #0b0c10;
    padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: bold; border: 2px solid; z-index: 5;
}
.card-icon { font-size: clamp(40px, 8vh, 50px); margin: 10px 0; text-shadow: 0 0 15px currentColor; }
.card-info h3 { margin: 10px 0; font-size: 16px; }

.legendary-card { animation: legendaryPulse 1.5s infinite alternate !important; border-width: 3px !important; }
@keyframes legendaryPulse {
    from { box-shadow: 0 0 15px currentColor, inset 0 0 5px currentColor; filter: brightness(1); }
    to { box-shadow: 0 0 35px currentColor, inset 0 0 20px currentColor; filter: brightness(1.2); }
}

.plus-sparkle { position: absolute; font-size: 40px; font-family: Arial, sans-serif; font-weight: bold; pointer-events: none; z-index: 10; animation: sparkleAnim 2s infinite linear; }
@keyframes sparkleAnim {
    0% { transform: scale(0) rotate(0deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(90deg); opacity: 1; filter: drop-shadow(0 0 10px currentColor); text-shadow: 0 0 15px currentColor; }
    100% { transform: scale(0) rotate(180deg); opacity: 0; }
}

.btn { 
    padding: 12px 25px; font-size: 18px; font-weight: bold; cursor: pointer; margin-top: 20px; 
    background-color: #1f2833; color: #66fcf1; border: 2px solid #45a29e; border-radius: 8px; transition: 0.2s; display: none;
}
.btn:hover { background-color: #45a29e; color: #0b0c10; box-shadow: 0 0 15px #66fcf1; }
.close-btn { float:right; background:#ff003c; color:#fff; border:none; padding:8px 15px; font-weight:bold; border-radius:8px; cursor:pointer; font-family:inherit; }

/* GÜNCELLENDİ: Popup Ekranları Artık Flexbox ve Taşmaz */
#helpScreen, #hsPopupScreen {
    display: none; flex-direction: column; position: absolute; top: 10%; left: 10%; width: 80%; height: 80%;
    background: #1f2833; border: 2px solid #45a29e; border-radius: 12px; z-index: 200;
    color: #c5c6c7; padding: 20px; box-sizing: border-box; box-shadow: 0 0 30px #45a29e; 
}
#helpScreen { display: none; overflow-y: auto; line-height: 1.5; font-size: clamp(12px, 3vw, 16px); }
#hsPopupScreen { display: none; overflow: hidden; padding-bottom: 20px; } 

.scroll-area { flex: 1; overflow-y: auto; padding-right: 5px; margin-top: 15px; }

#helpScreen h2 { color: #45a29e; border-bottom: 1px solid #45a29e; padding-bottom: 5px; margin-top: 20px;}
#helpScreen ul { margin-left: 20px; }
#helpScreen li { margin-bottom: 8px; }

.socials { text-align: center; color: #45a29e; font-size: clamp(12px, 3vw, 16px); margin-top: 20px; }
.socials p { margin-bottom:10px; font-family:'Courier New', Courier, monospace; }
.socials a { color: #66fcf1; text-decoration: none; margin: 0 10px; font-weight: bold; }

#debugMenu {
    display: none; position: absolute; bottom: 15px; left: 15px; background: rgba(0, 20, 0, 0.85);
    color: #00ff00; padding: 15px; font-size: 12px; line-height: 1.5; z-index: 100; border: 1px solid #00ff00;
    border-radius: 5px; pointer-events: none;
}
#damageMenu { display: none; position: absolute; bottom: 15px; right: 15px; gap: 10px; z-index: 100; pointer-events: none; min-width: 220px; }
.dmg-box { background: rgba(0, 0, 20, 0.85); border-radius: 5px; padding: 12px; font-size: 13px; line-height: 1.5; width: 100%; border: 1px solid #45a29e; box-shadow: 0 0 10px rgba(69,162,158,0.3); }

#loadoutMenu {
    display: none; position: absolute; top: 70px; right: 15px; z-index: 100; 
    border: 1px solid #ffcc00; background: rgba(0, 20, 0, 0.85); box-shadow: 0 0 10px rgba(255, 204, 0, 0.3); 
    width: 250px; max-width: 90vw; border-radius: 8px; padding: 10px;
}
.scroll-area-small { max-height: 35vh; overflow-y: auto; padding-right: 5px; }

.hs-input-group {
    display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 350px;
    background: rgba(0, 30, 0, 0.85); padding: 15px; border-radius: 10px; border: 1px solid #45a29e; margin-bottom: 10px; box-sizing: border-box;
}
.hs-input-group label { color:#66fcf1; font-size: clamp(14px, 4vw, 18px); text-align:center; }
.hs-input-group input {
    background: #1f2833; color: #fff; border: 2px solid #66fcf1; padding: 10px;
    font-size: 18px; font-family: 'Courier New', Courier, monospace; border-radius: 5px; text-align: center; outline: none; width: 100%; box-sizing: border-box;
}
.hs-input-group button {
    background: #45a29e; color: #0b0c10; border: none; padding: 10px 20px;
    font-size: 16px; font-weight: bold; border-radius: 5px; cursor: pointer; transition: 0.2s; width: 100%;
}

#hsTableArea {
    display: none; flex-direction: column; background: rgba(0, 0, 0, 0.85); padding: 15px; border-radius: 10px; box-sizing: border-box;
    border: 2px solid #ffdd00; width: 100%; max-width: 350px; margin-bottom: 10px; box-shadow: 0 0 20px rgba(255, 221, 0, 0.2);
    max-height: 50vh;
}
#hsTableArea h3 { color:#ffcc00; text-align:center; margin-top:0; margin-bottom:10px; font-size: 18px;}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0b0c10; border-radius: 3px; }
::-webkit-scrollbar-thumb { background: #45a29e; border-radius: 3px; }

#joyBase { display:none; position:absolute; width:100px; height:100px; border-radius:50%; background:rgba(255,255,255,0.1); border:2px solid rgba(102,252,241,0.4); transform:translate(-50%, -50%); z-index:90; pointer-events:none; }
#joyStick { display:none; position:absolute; width:40px; height:40px; border-radius:50%; background:rgba(102,252,241,0.7); transform:translate(-50%, -50%); z-index:90; pointer-events:none; box-shadow: 0 0 15px #66fcf1; }

@media (max-width: 768px) {
    #ui { font-size: 12px; top: 10px; left: 10px; width: max-content; }
    
    .card-container { 
        flex-direction: column; flex-wrap: nowrap; align-items: center; 
        gap: 10px; padding: 5px;
    }
    .card { 
        width: 100%; max-width: 340px; height: auto; min-height: 85px; padding: 10px; 
        flex-direction: row; text-align: left; gap: 15px; margin: 0;
    }
    .card-icon { font-size: 40px; margin: 0; min-width: 45px; text-align: center; }
    .card-info { display: flex; flex-direction: column; justify-content: center; }
    .card-info h3 { margin: 0 0 4px 0; font-size: 15px; }
    
    .rank-badge { font-size: 10px; top: -5px; right: -5px; padding: 2px 6px; }

    #loadoutMenu { top: 75px; right: 10px; width: 220px; font-size: 12px; }
    #damageMenu { display: none !important; } 
    
    #helpScreen, #hsPopupScreen { width: 96%; left: 2%; top: 5%; height: 90%; padding: 15px; }
}

@media (orientation: landscape) and (max-height: 500px) {
    .top-controls { top: 5px; padding: 5px 10px; }
    #levelUpTitle, #pauseScreen h1, #gameOverScreen h1 { margin-top: 60px; font-size: 26px; }
    
    .card-container { 
        flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; 
        max-height: unset; justify-content: flex-start; align-items: stretch; padding-bottom: 10px;
    }
    .card { min-width: 220px; flex-shrink: 0; padding: 10px; }
    .card-icon { font-size: 35px; margin: 5px 0; }
    .card-info h3 { font-size: 14px; margin: 5px 0; }
    
    #loadoutMenu { top: 55px; max-height: 70vh; }
    .scroll-area-small { max-height: 50vh; }
    
    .hs-input-group { padding: 10px; margin-bottom: 5px; }
}