/* ==========================================
   1. GENEL ATMOSFER (ROYAL SUITE)
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;800&display=swap');

:root {
    --primary: #2e7d32;
    --accent: #ffd700;       /* Altın Sarısı */
    --danger: #ff1744;       /* Neon Kırmızı */
    --info: #2979ff;         /* Neon Mavi */
    --text-dark: #212121;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0; padding: 0;
    font-family: 'Poppins', sans-serif;
    background: radial-gradient(circle at center, #1b5e20 0%, #000000 120%);
    color: #fff;
    height: 100vh; width: 100vw; overflow: hidden;
}

.screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; z-index: 1; opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease; background: transparent;
}
.screen.active { opacity: 1; pointer-events: all; }
.hidden { display: none !important; }

/* ==========================================
   2. OYUN MASASI
   ========================================== */
.header-bar {
    height: 60px; background: rgba(0,0,0,0.6);
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 15px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.masa-bilgi { font-weight: 800; font-size: 16px; color: var(--accent); letter-spacing: 1px; }
.header-right { display: flex; gap: 8px; align-items: center; }

.btn-icon { 
    background: rgba(255,255,255,0.15); border: none; color: #fff; 
    width: 38px; height: 38px; border-radius: 50%; font-size: 16px; 
    display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s;
}
.btn-icon:active { transform: scale(0.9); background: var(--accent); color: #000; }
.btn-undo { background: #546e7a; }

/* İZLEYİCİ UYARISI */
.spectator-badge {
    position: absolute; top: 65px; left: 50%; transform: translateX(-50%);
    background: rgba(255, 87, 34, 0.9); color: #fff; padding: 5px 15px;
    border-radius: 20px; font-size: 12px; font-weight: bold; z-index: 99;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); pointer-events: none; animation: slideDown 0.5s;
}
@keyframes slideDown { from { transform: translate(-50%, -20px); opacity:0; } to { transform: translate(-50%, 0); opacity:1; } }

/* TABLO */
/* ==========================================
   TABLO (DÜZELTİLMİŞ & SABİTLENMİŞ)
   ========================================== */
.king-table-container {
    flex: 1; 
    display: flex; 
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95); 
    margin: 5px; 
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6); 
    overflow: hidden; 
    color: #222; 
    border: 2px solid var(--primary);
}

/* Hem Başlık Hem Gövde İçin Aynı Grid Ayarı */
.table-header-row, .table-body-row {
    display: grid; 
    grid-template-columns: repeat(4, 1fr); /* 4 Eşit Sütun */
    width: 100%;
}

.table-header-row {
    background: #e0e0e0; 
    border-bottom: 3px solid var(--primary);
    /* Scrollbar payı bırakmak için padding */
    padding-right: 0; 
}

.th-name {
    font-weight: 900; 
    font-size: 11px; /* Mobilde sığması için */
    text-align: center; 
    color: #1b5e20;
    text-transform: uppercase; 
    border-right: 1px solid #ccc;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    padding: 8px 2px;
    
    /* Taşan yazıları ... yapma ayarı */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.th-name:last-child { border-right: none; }

.th-name.active-turn {
    background: var(--accent) !important; color: #000 !important;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.2); animation: pulseHeader 2s infinite;
}
@keyframes pulseHeader { 0% { box-shadow: inset 0 0 5px rgba(0,0,0,0.1); } 50% { box-shadow: inset 0 0 20px rgba(0,0,0,0.3); } 100% { box-shadow: inset 0 0 5px rgba(0,0,0,0.1); } }

.player-badges { display: flex; gap: 1px; margin-top: 2px; flex-wrap: wrap; justify-content: center;}
.badge-icon { font-size: 10px; color: #ccc; }
.badge-icon.filled-tri { color: #d50000; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3)); }
.badge-icon.filled-circle { color: #2962ff; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3)); }

.table-body-row { 
    flex: 1; 
    overflow-y: auto; 
    background: #fff; 
    /* Mobilde kaydırma çubuğu çıkarsa düzen bozulmasın */
    scrollbar-width: thin; 
}

/* Sütun Çizgilerinin Aşağı İnmesi İçin Kritik Ayar */
.player-column { 
    border-right: 1px solid #e0e0e0; 
    display: flex; 
    flex-direction: column; 
    cursor: pointer; 
    transition: background 0.1s; 
    min-width: 0; /* Grid içinde taşmayı önler */
}
.player-column:last-child { border-right: none; }
.player-column:active { background: #e8f5e9; }


.section-penalties {
    flex: 1; display: flex; flex-direction: column;
    background: repeating-linear-gradient(to bottom, #fff 0px, #fff 26px, #f9f9f9 26px, #f9f9f9 52px);
}
.penalty-row {
    height: 26px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 4px; border-bottom: 1px solid #eee; font-size: 11px; font-weight: 700;
}
.penalty-row span { color: #333; overflow: hidden; white-space: nowrap; max-width: 70%; }
.penalty-row b { color: var(--danger); }
.pending-entry { color: var(--info) !important; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.5; } }

.row-divider {
    padding: 5px 0; font-weight: 800; font-size: 13px; text-align: center;
    border-top: 2px solid #ccc; border-bottom: 2px solid #ccc; background: #eee; color: #333;
}

.section-trumps {
    flex: 0.5; padding: 5px; display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center; gap: 4px; background: #fff;
}
.trump-box {
    width: 24px; height: 24px; background: #e3f2fd; color: #1565c0; border: 2px solid #1565c0;
    border-radius: 5px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 12px;
}

.footer-total {
    background: #333; color: var(--accent); padding: 12px 0;
    text-align: center; font-weight: 900; font-size: 16px; border-top: 4px solid var(--accent);
}

.buzlu { color: transparent !important; text-shadow: 0 0 12px rgba(0,0,0,0.6); user-select: none; }
.buzlu.row-divider { background: #eee !important; border-color: #ccc !important; }
.buzlu.footer-total { background: #333 !important; border-top-color: var(--accent) !important; }

/* ==========================================
   3. YANCI, MODALLAR & DİĞER
   ========================================== */
.yanci-container {
    position: fixed; bottom: 80px; right: 10px; z-index: 999;
    display: flex; flex-direction: column; align-items: flex-end; pointer-events: none;
}
.yanci-bubble {
    background: #fff; color: #333; padding: 10px 15px; border-radius: 15px 15px 0 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); font-size: 12px; font-weight: bold; margin-bottom: 5px;
    max-width: 200px; opacity: 0; transform: translateY(20px); transition: 0.3s; pointer-events: all;
}
.yanci-bubble.show { opacity: 1; transform: translateY(0); }
.yanci-avatar {
    width: 50px; height: 50px; background: #fff; border-radius: 50%; border: 3px solid var(--accent);
    overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.3); pointer-events: all; cursor: pointer;
}
.yanci-avatar img { width: 100%; height: 100%; object-fit: cover; }

.toast-msg {
    position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
    background: #333; color: #fff; padding: 12px 24px; border-radius: 25px;
    font-weight: bold; z-index: 999999; box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    animation: slideDownFade 0.3s ease-out; text-align: center; border: 1px solid rgba(255,255,255,0.2);
}
@keyframes slideDownFade { from { transform: translate(-50%, -20px); opacity:0; } to { transform: translate(-50%, 0); opacity:1; } }

/* Modallar */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 99999; align-items: center; justify-content: center; backdrop-filter: blur(5px);
}
.modal.active { display: flex !important; animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: #fff; width: 90%; max-width: 380px; border-radius: 20px; padding: 25px;
    text-align: center; color: #333; box-shadow: 0 20px 60px rgba(0,0,0,0.5); position: relative;
    transform: scale(0.95); transition: 0.3s;
}
.modal.active .modal-content { transform: scale(1); }

/* QR Kodu ve Analiz İçin */
.qr-box img { width: 200px; height: 200px; margin: 10px 0; border: 5px solid #fff; box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
.analysis-list { text-align: left; font-size: 13px; margin-top: 10px; }
.analysis-item { padding: 10px; border-bottom: 1px solid #eee; display: flex; align-items: center; gap: 10px; }
.analysis-rank { font-weight: 900; font-size: 16px; color: var(--primary); width: 20px; }
.analysis-tip { font-size: 11px; color: #666; display: block; margin-top: 2px; font-style: italic; }

/* Butonlar & Lobi */
.numpad-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.btn-num { background: #fff; border: 1px solid #ccc; padding: 15px 0; border-radius: 10px; font-size: 20px; font-weight: 900; color: #333; cursor: pointer; box-shadow: 0 4px 0 #bbb; }
.btn-num:active { transform: translateY(3px); box-shadow: 0 1px 0 #bbb; }
.btn-rifki { grid-column: span 4; background: var(--danger); color: #fff; border-color: #b71c1c; box-shadow: 0 4px 0 #b71c1c; }
.btn-glitch { width: 100%; padding: 15px; border-radius: 12px; border: none; font-weight: 800; cursor: pointer; text-transform: uppercase; letter-spacing: 1px; transition: 0.2s; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #ffca28); color: #000; box-shadow: 0 5px 20px rgba(255, 215, 0, 0.3); }
.btn-primary:active { transform: scale(0.95); }

.lobi-container { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 20px; text-align: center; }
.logo-text { font-size: 50px; font-weight: 900; background: linear-gradient(to bottom, #ffd700, #ff8f00); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin: 0; filter: drop-shadow(0 0 10px rgba(255,215,0,0.3)); }
.glass-panel { background: rgba(255,255,255,0.1); padding: 25px; border-radius: 20px; width: 100%; max-width: 350px; backdrop-filter: blur(10px); margin-top: 20px; border: 1px solid rgba(255,255,255,0.15); }
.input-group { background: rgba(0,0,0,0.3); border-radius: 10px; margin-bottom: 10px; display: flex; align-items: center; padding: 10px; }
.input-group input { background: transparent; border: none; color: #fff; width: 100%; outline: none; margin-left: 10px; font-size: 16px; }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.kura-spinner { font-size: 60px; margin: 20px auto; display: inline-block; animation: spin 0.8s linear infinite; }
#confetti-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 999999; }

/* ... ÖNCEKİ STİLLER AYNEN KALACAK ... */

/* YENİ: KİMLİK SEÇİM BUTONLARI */
.btn-identity {
    padding: 15px;
    border-radius: 12px;
    border: 2px solid #eee;
    background: #fff;
    color: #333;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.btn-identity:hover {
    border-color: var(--primary);
    background: #f1f8e9;
}

.btn-identity i {
    font-size: 18px;
    color: var(--primary);
}

.btn-identity.spectator {
    background: #fafafa;
    color: #777;
    border-style: dashed;
}

/* ... DİĞER HER ŞEY AYNEN DEVAM ... */
/* (Tam dosyayı tekrar atmıyorum, eski style.css'in altına bunu eklemen yeterli veya önceki tam sürümü kullan) */
/* Ama garanti olsun diye önceki style.css'i kullan, sadece şunu ekle: */
.btn-identity {
    width: 100%;
    padding: 15px;
    margin-bottom: 8px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background: #fff;
    font-weight: 900;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-identity:active {
    transform: scale(0.98);
    background: #e8f5e9;
}

.btn-identity i {
    color: var(--primary);
}

/* ... ÖNCEKİ STİLLER AYNEN KALACAK ... */

/* Koltuk Boşaltma Butonu */
.kick-btn {
    background: #ffebee; color: #d32f2f; border: 1px solid #ffcdd2;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; cursor: pointer; margin-left: 10px;
}
.kick-btn:active { transform: scale(0.9); }

/* --- KURULUM EKRANI EKLENTİSİ --- */
.player-input-row {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
    animation: fadeIn 0.3s;
}

.setup-name-input {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    color: #333;
    font-weight: 600;
}

.btn-remove-player {
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 5px;
    width: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-half {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-weight: 800;
    cursor: pointer;
    color: #fff;
}