body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Giriş ekranı için arka plan resmi */
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('https://mpqncrkclcprjmaohpgm.supabase.co/storage/v1/object/public/back/koaback.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed; /* Kaydırma sırasında arka plan sabit kalır */
    color: #fff;
    text-align: center;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Giriş yapıldıktan sonraki düz arkaplan */
body.app-mode {
    background-image: none;
    background-color: #36393f;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    background-color: rgba(44, 47, 51, 0.8); /* Hafif transparan header */
    backdrop-filter: blur(5px); /* Arka plana bulanıklık efekti */
}

#header-logo {
    height: 40px; /* Logonun yüksekliği */
    width: auto;
    margin: 0; /* h1'den kalan boşlukları sıfırla */
}

main {
    flex-grow: 1; /* Main alanının kalan tüm boşluğu kaplamasını sağlar */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box; /* Padding'in yüksekliği etkilemesini engeller */
}

.hidden {
    display: none !important;
}

.form-container {
    background-color: #2c2f33; /* Konteyner rengi */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 300px;
}
/* --- YENİ SEKMELİ YAPI STİLLERİ --- */
#auth-container {
    width: 100%;
    display: flex;
    justify-content: flex-end; /* Kutuyu sağa yaslar */
    padding: 0 5%;
}

#auth-box {
    background-color: #2c2f33;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    padding: 25px;
    border-radius: 8px;
    width: 350px;
    display: flex;
    flex-direction: column;
}

.tab-buttons {
    display: flex;
    border-bottom: 1px solid #4f545c;
    margin-bottom: 20px;
}

.tab-button {
    flex: 1;
    padding: 12px;
    background-color: transparent;
    border: none;
    color: #b9bbbe;
    cursor: pointer;
    font-size: 16px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.tab-button:hover {
    color: #fff;
    background-color: transparent; /* Ana buton hover'ını ezer */
}

.tab-button.active {
    color: #fff;
    border-bottom: 2px solid #7289da;
}

input {
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #666;
    background-color: #40444b;
    color: #fff;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
}

.tab-content {
    display: none;
}

/* BUTON STİLİ GÜNCELLEMESİ: Daha spesifik hale getirerek çakışmayı önlüyoruz. */
button, 
.menu-button,
.tab-button {
    padding: 10px 15px;
    border-radius: 4px;
    border: none;
    background-color: #7289da; /* Discord mavisi gibi bir renk */
    color: white;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease;
}

.tab-content.active {
    display: block;
}

button:hover, 
.menu-button:hover,
.tab-button:hover {
    background-color: #677bc4;
}

button:active, 
.menu-button:active {
    transform: scale(0.98);
}

#logout-button {
    background-color: #dc3545;
}

#logout-button:hover {
    background-color: #c82333;
}

/* --- YENİ PROFİL DROPDOWN --- */
#profile-dropdown {
    position: relative;
}

#profile-avatar-button {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px;
    border-radius: 20px;
    background-color: #2c2f33;
    transition: background-color 0.2s;
}

#profile-avatar-button:hover {
    background-color: #40444b;
}

#profile-avatar-button .player-avatar {
    width: 30px;
    height: 30px;
}

#profile-menu {
    position: absolute;
    top: 110%;
    right: 0;
    background-color: #2c2f33;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    width: 200px;
    z-index: 100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#profile-menu a {
    padding: 12px 15px;
    color: #b9bbbe;
    text-decoration: none;
    display: block;
    text-align: left;
}

#profile-menu a:hover {
    background-color: #40444b;
    color: #fff;
}

/* --- YENİ UYGULAMA GÖRÜNÜMÜ --- */
#app-view {
    width: 100%;
    padding: 40px;
    box-sizing: border-box;
}

#menu-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    width: 100%;
    max-width: 800px;
}

.menu-card {
    background-color: #2c2f33;
    padding: 25px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left: 4px solid #7289da;
}

.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.menu-card h3 {
    margin-top: 0;
    color: #fff;
}

.menu-card p {
    margin-bottom: 0;
    color: #b9bbbe;
}

/* --- YENİ OYUN EKRANI VE OYUNCU PANELLERİ --- */
#game-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    justify-content: space-between;
}

.player-panel.active-turn {
    box-shadow: 0 0 15px rgba(114, 137, 218, 0.5);
}

.player-panel {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background-color: #2c2f33;
    border-radius: 8px;
    gap: 15px;
}

.player-panel.bottom {
    background-color: #23272a; /* Aktif oyuncu paneli biraz daha farklı olabilir */
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #40444b;
    object-fit: cover;
}

.player-info {
    flex-grow: 1;
    text-align: left;
}

.player-name {
    font-weight: bold;
    font-size: 16px;
}

.player-elo {
    font-size: 14px;
    color: #b9bbbe;
    margin-left: 5px;
}

.player-timer {
    font-size: 20px;
    font-weight: bold;
    background-color: #1e2124;
    padding: 5px 15px;
    border-radius: 4px;
}

#game-board-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 0;
    min-height: 0; /* Flexbox'ın düzgün küçülmesini sağlar */
}

#game-actions {
    padding: 10px 0;
}

#resign-button {
    background-color: #40444b;
}

#resign-button:hover {
    background-color: #dc3545;
}
/* --- MODERN SATRANÇ TAHTASI RENKLERİ --- */
.spare-pieces-23b26, .promotion-dialog-23b26 {
    background-color: #2c2f33 !important;
}
.white-1e1d7 {
    background-color: #b9bbbe;
}
.black-3c85d {
    background-color: #7289da;
}

/* --- OYUN DURUM MESAJI --- */
#game-status-message {
    /* Bu şimdilik gizli, oyun sonu için kullanılacak */
}
#game-board {
    width: 100%;
    /* max-width ve max-height, wrapper'ın boyutuna göre JS ile ayarlanacak */
}

/* Eski #game-board kuralını güncelliyoruz */
/* #game-board {
    width: 100%;
    max-width: 400px; /* Satranç tahtasının maksimum genişliği */
}

.error-message {
    color: #f04747;
    margin-top: 15px;
    min-height: 20px;
}

#game-info {
    margin-top: 15px;
}

/* --- KVKK ONAY KUTUSU STİLLERİ --- */
.terms-container {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* İçeriği sola yasla */
    font-size: 12px;
    text-align: left;
    margin-bottom: 15px;
    gap: 8px; /* Kutucuk ve metin arası boşluk */
}

.terms-container label {
    color: #b9bbbe;
    cursor: pointer;
}

.terms-container a {
    color: #7289da;
    text-decoration: none;
}

.terms-container a:hover {
    text-decoration: underline;
}

.terms-container input[type="checkbox"] {
    width: auto; /* Otomatik genişlik */
    margin: 0; /* Tarayıcı varsayılanlarını sıfırla */
    accent-color: #7289da; /* Onay kutusunun rengini ayarla */
}

/* --- POPUP PENCERESİ STİLLERİ --- */
#popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#popup-box {
    background-color: #2c2f33;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 600px;
    position: relative;
    text-align: left;
}

#close-popup {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #fff;
    cursor: pointer;
}

/* --- OYUN AYARLARI POPUP --- */
#game-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#game-settings-box {
    background-color: #2c2f33;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 450px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

#close-settings-popup {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #fff;
    cursor: pointer;
}

.setting-item label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    text-align: left;
}

.setting-item input[type="text"] {
    margin-bottom: 0;
}

.button-group {
    display: flex;
}

.button-group button {
    flex: 1;
    background-color: #40444b;
    border-radius: 0;
}

.button-group button.selected {
    background-color: #7289da;
}

.button-group button:first-child { border-radius: 4px 0 0 4px; }
.button-group button:last-child { border-radius: 0 4px 4px 0; }

/* --- OYUN BİTTİ POPUP --- */
#game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001; /* Diğer popupların üzerinde */
}

#game-over-box {
    background-color: #2c2f33;
    padding: 30px 40px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

#game-over-box h2 {
    margin-top: 0;
}

#game-over-box p {
    font-size: 18px;
    margin: 10px 0 25px 0;
}

.game-over-actions {
    display: flex;
    gap: 15px;
}
/* --- MOBİL UYUMLULUK (RESPONSIVE) --- */
@media (max-width: 768px) {
    header {
        padding: 10px 20px;
    }

    #auth-container {
        justify-content: center; /* Küçük ekranlarda kutuyu ortala */
        padding: 0 15px;
    }

    #auth-box {
        width: 100%; /* Kutunun ekranı doldurmasını sağla */
        max-width: 350px; /* Ama çok da büyümesin */
    }

    .menu-grid {
        grid-template-columns: 1fr; /* Küçük ekranlarda kartları alt alta diz */
    }

    #app-view {
        padding: 20px;
    }

    #game-container {
        gap: 10px;
    }
}
