/* ============================================================ */
/* Kovboylar Zamanı - Modern & Rustik CSS (v.143)            */
/* ============================================================ */

* {
    margin: 0; padding: 0; box-sizing: border-box;
    user-select: none;
}

body {
    background-color: #1a0f0a;
    color: #f5deb3;
    font-family: 'Special Elite', cursive;
    overflow: hidden;
    position: fixed; 
    top: 0; left: 0; right: 0; bottom: 0;
    touch-action: none; /* Mobilde her türlü scroll ve esnemeyi tamamen durdurur */
}

#game-container {
    position: relative;
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
}

canvas { display: block; background: #000000; }

#game-ui {
    position: absolute; inset: 0;
    pointer-events: none; z-index: 10;
}

.player-stats {
    position: absolute; top: 15px; left: 15px;
    background: rgba(0,0,0,0.5); padding: 8px 12px 8px 14px;
    border: 1px solid #131608; border-radius: 10px; width: 195px;
    backdrop-filter: blur(5px);
}

.stats-header {
    display: flex; justify-content: space-between; margin-bottom: 4px;
    font-weight: bold; color: white; font-size: 18px;
    text-shadow: 2px 2px 3px black;
    padding-right: 4px;
}

#game-version {
    color: #ffd700; font-size: 11px; opacity: 0.8;
}

/* v.252 - bar1.png Stili Sağlık ve Stamina Barları ( %70 Ölçekli ) */
.stat-bar {
    position: relative;
    width: calc(100% - 10px); height: 18px; 
    background: linear-gradient(to bottom, #1a1a1a, #333);
    border-radius: 9px;
    margin-bottom: 8px;
    margin-left: 9px;
    box-sizing: border-box;
    /* 3D Çerçeve Efekti */
    border: 2px solid #131608;
    box-shadow: 
        inset 0 1px 3px rgba(0,0,0,0.8),
        0 0 0 1.5px #ff8f00, 
        0 0 3px rgba(0,0,0,0.5);
    overflow: visible;
}

/* İkonlar İçin Ortak Ayar */
.stat-bar::before {
    position: absolute;
    left: -15px; top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    z-index: 5;
    filter: drop-shadow(0 2px 3px black);
}

/* Sağlık Barı Karakteristiği */
.stat-bar:not(.stamina-container)::before {
    content: '❤️';
}

/* Stamina Barı Karakteristiği */
.stamina-container::before {
    content: '⚡';
}

#hp-bar { 
    width: 100%; height: 100%; 
    background: linear-gradient(to bottom, #ff5252 0%, #ff1744 40%, #d50000 100%);
    border-radius: 10px; 
    transition: width 0.3s, background-color 0.3s;
    box-shadow: inset 0 2px 5px rgba(255,255,255,0.4), inset 0 -2px 5px rgba(0,0,0,0.3);
}

.stamina-container { 
    height: 18px !important; 
    border: 2px solid #3e2723 !important; 
    box-shadow: 
        inset 0 1px 3px rgba(0,0,0,0.8),
        0 0 0 1.5px #00afff, 
        0 0 3px rgba(0,0,0,0.5) !important;
}

#stamina-bar { 
    width: 100%; height: 100%; 
    background: linear-gradient(to bottom, #448aff 0%, #2979ff 40%, #2962ff 100%);
    border-radius: 10px; 
    transition: width 0.1s; 
    box-shadow: inset 0 2px 5px rgba(255,255,255,0.4), inset 0 -2px 5px rgba(0,0,0,0.3);
}

.money-info { 
    font-size: 0.95rem; font-weight: bold; color: #ffd700; 
    text-shadow: 1px 1px 2px black; margin-top: 3px;
}

#weapon-bar {
    position: absolute; bottom: 0; left: 50%;
    transform: translateX(-50%) scale(0.7); 
    transform-origin: bottom center;
    display: flex; gap: 15px;
    background: rgba(0,0,0,0.6); padding: 15px 15px 5px 15px;
    border-radius: 12px 12px 0 0; border: 1px solid rgba(255,255,255,0.1);
    pointer-events: auto;
}

.weapon-btn {
    width: 110px; height: 120px;
    background: rgba(43, 27, 23, 0.9);
    border: 3px solid #5d4037; border-radius: 10px;
    cursor: pointer; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    position: relative; transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white; font-family: 'Special Elite', cursive;
}

.weapon-btn span {
    display: block;
    margin-top: 2px;
}

/* v.223 - Oda Yazısı Görünürlük Garantisi */
#global-current-room-text {
    color: #4fc3f7 !important;
    font-weight: bold !important;
    text-shadow: 0 0 5px rgba(79, 195, 247, 0.5) !important;
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.weapon-name {
    font-weight: bold;
    color: #fff;
    font-size: 14px !important;
    text-shadow: 1px 1px 2px #000;
}

.weapon-price {
    color: #ffd700;
    font-size: 14px !important;
    font-weight: 900 !important;
    text-shadow: 2px 2px 3px #000;
    background: rgba(0,0,0,0.5);
    padding: 2px 5px;
    border-radius: 4px;
    margin-top: 5px !important;
}

.weapon-key {
    position: absolute; top: 4px; left: 6px;
    font-size: 10px; color: rgba(255,255,255,0.5);
}

.weapon-ammo {
    font-size: 18px !important;
    font-weight: 900;
    color: #81c784;
    text-shadow: 1px 1px 3px #000;
}

.weapon-icon { font-size: 36px; margin-bottom: 2px; }
.lock-icon { position: absolute; font-size: 32px; z-index: 10; opacity: 0.8; top: 20%; }

#leaderboard {
    position: absolute; top: 190px; right: 20px;
    background: rgba(0,0,0,0.5); border: 1px solid #131608;
    padding: 10px 15px; border-radius: 8px; 
    min-width: 180px; backdrop-filter: blur(5px);
}

#leaderboard h3 {
    color: #ed822b;
    margin-bottom: 8px;
    text-align: center;
    font-family: 'Rye', cursive;
    font-size: 1.2rem;
    text-shadow: 1px 1px 2px black;
}

.score-row { display: flex; justify-content: space-between; margin: 4px 0; border-bottom: 1px solid rgba(255,215,0,0.1); font-size: 14px; }
.score-row.first-place { color: #e49100; font-weight: bold; }
.hidden { display: none !important; }

/* ===== MINI HARITA ===== */
#mini-map-container {
    position: absolute; top: 20px; right: 20px;
    width: 200px; height: 150px;
    background: rgba(0,0,0,0.7); border: 1px solid #131608;
    border-radius: 8px; overflow: hidden; pointer-events: none; backdrop-filter: blur(5px);
}
#mini-map-canvas { width: 100%; height: 100%; display: block; background: rgba(0,0,0,0.3);}

.overlay {
    position: fixed; inset: 0; background: #425221;
    display: flex; align-items: center; justify-content: center; z-index: 2000;
}
#death-screen { background: rgba(0,0,0,0.5); }

.wanted-poster {
    background: url('giris.png') no-repeat center center;
    background-size: contain;
    padding: 0;
    position: relative;
    width: 562px; height: 510px;
    display: flex; flex-direction: column;
    justify-content: flex-end; align-items: center;
    overflow: hidden;
}

.login-controls {
    width: 100%;
    background: transparent; padding: 15px;
    display: flex; align-items: flex-end; justify-content: center; gap: 15px;
    box-sizing: border-box;
    margin-bottom: 100px;
}

.input-group {
    display: flex; flex-direction: column; gap: 5px; width: 50%;
}

.input-label {
    color: #646363; font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, "sans-serif"; font-size: 0.9rem;
}

#username-input {
    background: rgba(255,255,255,0.9); border: 1px solid #cccccc;
    color: #9b2c05; font-family: 'Special Elite', cursive; font-size: 1.3rem;
    padding: 12px 20px; outline: none; width: 100%; border-radius: 6px;
    transition: border-color 0.3s;
}

#username-input:focus {
    border-color: #6f0303;
}

#start-btn {
    background: linear-gradient(to bottom, #8d6e63, #5d4037); 
    color: #ffd700; border: 1px solid #cccccc;
    padding: 12px 35px; font-family: 'Rye', cursive; font-size: 1.2rem;
    cursor: pointer; transition: all 0.3s; border-radius: 6px;
    text-shadow: 1px 1px 2px black;
}

#start-btn:hover {
    background: linear-gradient(to bottom, #a1887f, #6d4c41);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255,215,0,0.3);
}

#start-btn:disabled {
    opacity: 0.6; cursor: not-allowed; transform: none;
}

.death-title { font-family: 'Rye', cursive; font-size: 5rem; color: #e53935; text-shadow: 0 0 20px black; margin-bottom: 10px; }


/* PRELOADER SCREEN STYLING (Standard Company Theme) */
#preloader {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: #72b6f3;
    z-index: 10000; /* Her seyin ustunde */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
    width: 80%;
    max-width: 400px;
}

.preloader-logo {
    width: 200px;
    height: auto;
    margin-bottom: 40px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    animation: preloaderPulse 2s infinite ease-in-out;
}

@keyframes preloaderPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.preloader-bar-container {
    width: 200px; 
    margin: 0 auto;
    height: 12px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    border: 1.5px solid rgba(255,255,255,0.2);
}

#preloader-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffd700, #ff9900);
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(255,165,0,0.5);
    transition: width 0.3s ease-out;
}

#preloader-percentage {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: #fff;
    margin-top: 15px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.preloader-status {
    font-family: 'Pirata One', cursive;
    color: rgba(255,255,255,0.8);
    font-size: 1.2rem;
    margin-top: 5px;
    letter-spacing: 1px;
}

#respawn-timer {
    font-size: 8rem; color: #fff;
    text-shadow: 0 0 30px #e53935;
    margin: 20px 0; font-family: 'Rye', cursive;
    animation: respawn-pulse 1s infinite alternate;
}
@keyframes respawn-pulse {
    from { transform: scale(1); text-shadow: 0 0 20px #e53935; }
    to { transform: scale(1.2); text-shadow: 0 0 50px #ffeb3b, 0 0 20px #ffeb3b; color: #ffeb3b; }
}
/*================ MOBİL KONTROLLER ================*/
#mobile-controls {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 50vh;
    pointer-events: none;
    z-index: 500;
}
.joystick-zone {
    position: absolute;
    bottom: 20px;
    width: 150px; height: 150px;
    pointer-events: auto;
}
#joystick-left-zone { left: 20px; }

#mobile-shoot-btn {
    position: absolute;
    bottom: 25px; right: 25px;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: rgba(229, 57, 53, 0.85); /* Koyu Kırmızı */
    border: 4px solid #b71c1c;
    color: white; font-size: 40px;
    box-shadow: 0 0 20px rgba(0,0,0,0.8), inset 0 0 15px rgba(255,255,255,0.2);
    pointer-events: auto;
    display: flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
#mobile-shoot-btn:active {
    background: rgba(183, 28, 28, 0.95);
    transform: scale(0.95);
    box-shadow: 0 0 10px rgba(0,0,0,0.8);
}
#mobile-sprint-btn {
    position: absolute;
    bottom: 30px; right: 135px;
    width: 65px; height: 65px;
    border-radius: 50%;
    background: rgba(33, 150, 243, 0.85);
    border: 3px solid #1565c0;
    color: white; font-size: 30px;
    box-shadow: 0 0 15px rgba(0,0,0,0.6);
    pointer-events: auto;
    display: flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
    z-index: 501;
}
#mobile-sprint-btn:active {
    background: rgba(21, 101, 192, 0.95);
    transform: scale(0.92);
}
#mobile-shoot-btn.hidden, #mobile-sprint-btn.hidden { display: none !important; }

.joystick-base {
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    border: 3px solid rgba(255,255,255,0.3);
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.joystick-stick {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    border: 2px solid rgba(0,0,0,0.5);
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    transition: background 0.2s;
}
.joystick-stick.active {
    background: rgba(255, 152, 0, 0.9);
}

@media (min-width: 901px) {
    #mobile-controls { display: none !important; }
}

@media (max-width: 900px) {
    #weapon-bar {
        bottom: 0; padding: 10px 10px 5px 10px; gap: 8px;
        transform: translateX(-50%) scale(0.50);
        transform-origin: bottom center;
    }
    .player-stats {
        transform: scale(0.60);
        transform-origin: top left;
        top: 5px; left: 5px;
    }
    #leaderboard {
        transform: scale(0.60);
        transform-origin: top right;
        top: 110px; right: 5px;
    }
    #mini-map-container {
        transform: scale(0.65);
        transform-origin: top right;
        top: 5px; right: 5px;
    }
}
