/* ==========================================
   1. CSS DEĞİŞKENLERİ VE RENK PALETİ
========================================== */
:root {
    /* Arka Plan Tonları (Lacivert ve Koyu Mor) */
    --bg-deep: #0a0816;
    --bg-navy: #151236;
    --bg-panel: rgba(21, 18, 54, 0.65);
    
    /* Vurgu Renkleri (Mor ve Lila) */
    --primary-purple: #8a2be2; /* BlueViolet */
    --neon-purple: #a64dff;
    --lilac: #c8a2c8;
    --lilac-muted: rgba(200, 162, 200, 0.4);
    
    /* Metin Renkleri */
    --text-main: #f8f9fa;
    --text-muted: #adb5bd;
    
    /* Durum Renkleri (Karanlık temaya uygun pastel) */
    --success: #2ecc71;
    --danger: #e74c3c;
    --warning: #f1c40f;
    
    /* Efektler */
    --glass-border: 1px solid rgba(200, 162, 200, 0.15);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* ==========================================
   2. TEMEL SIFIRLAMA VE TYPOGRAPHY
========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background: radial-gradient(circle at top left, var(--bg-navy), var(--bg-deep) 80%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Taşmaları engelle */
}

/* Scrollbar Özelleştirme */
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: var(--primary-purple); border-radius: 4px; }

/* Genel Yardımcı Sınıflar */
.hidden { display: none !important; }
.disabled { opacity: 0.5; pointer-events: none; }
.mt-auto { margin-top: auto; }
.user-select-all { user-select: all; cursor: pointer; }

/* ==========================================
   3. ANA YAPI (GLASSMORPHISM)
========================================== */
.glass-panel {
    width: 95%;
    max-width: 1100px;
    height: 90vh;
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
}

.view-state {
    display: flex;
    flex-direction: column;
    height: 100%;
    animation: fadeIn 0.4s ease;
}

.view-state:not(.active) { display: none; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   4. TİPOGRAFİ VE FORMLAR
========================================== */
h1, h2, h3 { color: var(--lilac); margin-bottom: 1rem; }

.gradient-text {
    background: linear-gradient(45deg, var(--lilac), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 3rem;
    font-weight: 800;
    text-align: center;
}

.subtitle { text-align: center; color: var(--text-muted); margin-bottom: 2rem; }

.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--lilac); font-weight: 600; font-size: 0.9rem; }
.hint { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }

input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--lilac-muted);
    border-radius: 10px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

input:focus, select:focus {
    border-color: var(--neon-purple);
    box-shadow: 0 0 10px rgba(166, 77, 255, 0.3);
    background: rgba(0, 0, 0, 0.4);
}

select[multiple] { height: 120px; padding: 8px; }
select option { background: var(--bg-navy); color: var(--text-main); padding: 8px; }

.range-inputs { display: flex; align-items: center; gap: 10px; }
.range-inputs span { color: var(--lilac); font-weight: bold; }

/* ==========================================
   5. BUTONLAR
========================================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
}

.btn-primary { background: var(--primary-purple); }
.btn-primary:hover { background: var(--neon-purple); transform: translateY(-2px); }
.btn-secondary { background: rgba(255,255,255,0.1); border: 1px solid var(--lilac-muted); }
.btn-secondary:hover { background: rgba(255,255,255,0.2); }

.btn-success { background: rgba(46, 204, 113, 0.2); color: var(--success); border: 1px solid var(--success); }
.btn-success:hover { background: var(--success); color: white; }
.btn-danger { background: rgba(231, 76, 60, 0.2); color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-warning { background: rgba(241, 196, 15, 0.2); color: var(--warning); border: 1px solid var(--warning); }
.btn-warning:hover { background: var(--warning); color: #000; }

.btn-glow { box-shadow: 0 0 15px rgba(138, 43, 226, 0.5); }
.btn-glow:hover { box-shadow: 0 0 25px rgba(166, 77, 255, 0.8); }

.btn-icon { padding: 8px; border-radius: 8px; background: rgba(255,255,255,0.1); width: 40px; height: 40px; }
.btn-icon.active { background: rgba(138, 43, 226, 0.3); border: 1px solid var(--primary-purple); }
.btn-block { width: 100%; }

/* ==========================================
   6. LOBİ VE KART TASARIMLARI
========================================== */
.card {
    background: rgba(0, 0, 0, 0.2);
    border: var(--glass-border);
    border-radius: 15px;
    padding: 1.5rem;
}

.lobby-header { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.highlight { background: rgba(138, 43, 226, 0.3); padding: 4px 12px; border-radius: 6px; border: 1px solid var(--primary-purple); letter-spacing: 2px; }

.lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; height: calc(100% - 80px); }
.players-panel ul { list-style: none; overflow-y: auto; max-height: 100%; }
.players-panel li { 
    padding: 12px; margin-bottom: 8px; 
    background: rgba(255,255,255,0.03); 
    border-radius: 8px; border-left: 4px solid var(--lilac);
    display: flex; justify-content: space-between; align-items: center;
}

.waiting-spinner { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; color: var(--lilac); }
.spinner { width: 40px; height: 40px; border: 4px solid rgba(200,162,200,0.3); border-top-color: var(--neon-purple); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================
   7. OYUN EKRANI VE KELİME KARTI
========================================== */
.game-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding: 1rem 1.5rem; }
.score-board { display: flex; gap: 2rem; font-weight: bold; font-size: 1.2rem; }
.team-a { color: #3498db; }
.team-b { color: #e74c3c; }
.timer { font-size: 2.5rem; font-weight: 800; color: var(--lilac); text-shadow: 0 0 10px rgba(200, 162, 200, 0.5); }
.media-controls { display: flex; gap: 10px; }

.game-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; height: calc(100% - 100px); }

.play-area { display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }

.status-badge { position: absolute; top: 0; background: rgba(138, 43, 226, 0.2); border: 1px solid var(--primary-purple); padding: 8px 16px; border-radius: 20px; font-weight: 600; color: var(--lilac); }

.taboo-card {
    background: linear-gradient(145deg, rgba(30, 25, 70, 0.9), rgba(20, 15, 50, 0.9));
    border: 2px solid var(--neon-purple);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 30px rgba(138, 43, 226, 0.3);
    overflow: hidden;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.card-header { background: rgba(138, 43, 226, 0.2); padding: 2rem 1rem; border-bottom: 2px solid var(--primary-purple); }
.card-header h2 { font-size: 2.5rem; color: #fff; margin: 0; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }

#forbidden-words { list-style: none; padding: 1.5rem; }
#forbidden-words li { font-size: 1.3rem; margin-bottom: 12px; color: var(--lilac); font-weight: 600; }

.narrator-actions { display: flex; gap: 1rem; margin-top: 2rem; width: 100%; max-width: 400px; justify-content: center; }

/* ==========================================
   8. YAZILI SOHBET (CHAT)
========================================== */
.chat-panel { display: flex; flex-direction: column; height: 100%; padding: 1rem; }
.chat-header { font-weight: bold; color: var(--lilac); border-bottom: 1px solid var(--lilac-muted); padding-bottom: 0.5rem; margin-bottom: 1rem; }
.messages-container { flex-grow: 1; overflow-y: auto; margin-bottom: 1rem; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; }
.chat-msg { background: rgba(255,255,255,0.05); padding: 8px 12px; border-radius: 8px; border-bottom-left-radius: 0; align-self: flex-start; max-width: 90%; word-break: break-word; }
.chat-msg.self { background: rgba(138, 43, 226, 0.2); border-bottom-left-radius: 8px; border-bottom-right-radius: 0; align-self: flex-end; }
.chat-msg span.sender { font-weight: bold; color: var(--lilac); margin-right: 5px; font-size: 0.8rem; }
.chat-input-wrapper { display: flex; gap: 10px; }
.chat-input-wrapper input { margin-bottom: 0; }

/* ==========================================
   9. SÜRPRİZ YUMURTA & TOAST BİLDİRİMLERİ
========================================== */
.overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(10, 8, 22, 0.95); z-index: 9999; display: flex; justify-content: center; align-items: center; }
.bounce-glow-text { font-size: 5vw; color: var(--lilac); animation: bounce 2s infinite, glow 1.5s infinite alternate; }

@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-30px); } 60% { transform: translateY(-15px); } }
@keyframes glow { from { text-shadow: 0 0 10px #fff, 0 0 20px var(--primary-purple); } to { text-shadow: 0 0 20px #fff, 0 0 40px var(--neon-purple), 0 0 60px var(--lilac); } }

.toast-container { position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-navy); border-left: 4px solid var(--primary-purple); color: white; padding: 12px 20px; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); font-size: 0.9rem; animation: slideIn 0.3s ease forwards; opacity: 0; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ==========================================
   10. RESPONSIVE TASARIM
========================================== */
@media (max-width: 768px) {
    .glass-panel { padding: 1rem; height: 95vh; border-radius: 10px; }
    .lobby-grid, .game-layout { grid-template-columns: 1fr; height: auto; }
    .players-panel, .settings-panel, .chat-panel { height: 300px; }
    .score-board { gap: 1rem; font-size: 1rem; }
    .timer { font-size: 2rem; }
    .card-header h2 { font-size: 2rem; }
}