/* ====================================================
   DEĞİŞKENLER VE TEMEL AYARLAR
==================================================== */
:root {
    --bg-color: #fce4ec; 
    --text-dark: #1e272e;
    --primary: #9b59b6; 
    --secondary: #f1c40f; 
    --danger: #ff4757; 
    --success: #2ed573; 
    --blue: #1e90ff; 
    --border-width: 4px;
    --border-color: #1e272e; 
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 20px;
    font-family: 'Fredoka', sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-color);
    background-image: radial-gradient(var(--primary) 10%, transparent 10%);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    flex-direction: column;
    gap: 20px;
}

.hidden { display: none !important; }

/* ====================================================
   ANA PANELLER VE LOBİ DÜZENİ
==================================================== */
.game-panel {
    background: #ffffff;
    width: 100%;
    max-width: 450px;
    padding: 30px;
    border-radius: 20px;
    border: var(--border-width) solid var(--border-color);
    box-shadow: 8px 8px 0px var(--border-color);
    text-align: center;
    position: relative;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: 0; 
}

h2, h3 { margin-top: 0; font-weight: 800; color: var(--text-dark); }

.game-title {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 3px 3px 0px var(--border-color);
    margin: 0 0 20px 0;
    letter-spacing: 2px;
}
.title-icon { display: inline-block; animation: bounce 2s infinite; }

/* --- GİRİŞ ALANLARI VE BUTONLAR --- */
.input-group { margin-bottom: 20px; }
input[type="text"], input[type="number"] {
    width: 100%; padding: 15px; font-size: 1.2rem;
    font-family: 'Fredoka', sans-serif; font-weight: 600;
    color: var(--text-dark); background: #f1f2f6;
    border: var(--border-width) solid var(--border-color);
    border-radius: 12px; text-align: center;
    transition: all 0.2s ease;
}
input:focus {
    outline: none; background: #fff; transform: scale(1.02);
    box-shadow: 4px 4px 0px var(--primary);
}

.fun-btn {
    width: 100%; padding: 15px; font-size: 1.3rem; font-weight: 900;
    font-family: 'Fredoka', sans-serif; color: var(--text-dark);
    border: var(--border-width) solid var(--border-color);
    border-radius: 12px; cursor: pointer;
    box-shadow: 4px 4px 0px var(--border-color);
    transition: all 0.1s ease; text-transform: uppercase; margin-top: 10px;
}
.fun-btn:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px transparent; }
.btn-primary { background-color: var(--success); }
.btn-secondary { background-color: var(--secondary); }
.btn-blue { background-color: var(--blue); color: white; }

/* --- IZGARA & ODA AYARLARI --- */
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px; }
.setup-item label { display: block; font-weight: 700; margin-bottom: 5px; font-size: 0.9rem; }
.divider { display: flex; align-items: center; text-align: center; margin: 25px 0; color: #a4b0be; font-weight: 700; }
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 3px dashed var(--border-color); opacity: 0.3; }
.divider span { padding: 0 10px; }

.room-type-section { display: flex; gap: 10px; justify-content: center; margin-bottom: 20px; }
.fun-radio { cursor: pointer; flex: 1; }
.fun-radio input { display: none; }
.radio-box {
    display: block; padding: 10px; border: 3px solid var(--border-color);
    border-radius: 10px; font-weight: 700; background: #fff; transition: all 0.2s;
}
.fun-radio input:checked + .radio-box { background: var(--primary); color: #fff; transform: scale(1.05); box-shadow: 3px 3px 0px var(--border-color); }

.rooms-list-box, .spectator-box {
    background: #fff; padding: 15px; border-radius: 12px;
    border: var(--border-width) solid var(--border-color);
    box-shadow: 4px 4px 0px var(--border-color); font-weight: 700; margin-bottom: 20px;
}
.room-code-display {
    display: inline-block; background: var(--secondary); padding: 5px 15px;
    border-radius: 8px; border: 2px solid var(--border-color); cursor: pointer;
}

/* --- TAKIM SEÇİM LOBİSİ --- */
.team-container { display: flex; gap: 15px; margin-bottom: 25px; flex-wrap: wrap; }
.team-box {
    flex: 1; min-width: 200px; padding: 20px; border-radius: 16px; background: #fff;
    border: var(--border-width) solid var(--border-color); box-shadow: 4px 4px 0 var(--border-color);
}
.red-team h3 { color: var(--danger); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 4px; }
.blue-team h3 { color: var(--blue); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 4px; }
.player-list { list-style: none; padding: 0; margin: 0; font-size: 1.1rem; font-weight: 700; text-align: center; }
.player-list li { padding: 8px 0; border-bottom: 2px dashed #ccc; }
.player-list li:last-child { border-bottom: none; }
.wait-text { font-size: 0.9rem; font-weight: 700; color: #888; margin-top: 10px; }


/* ====================================================
   OYUN EKRANI VE KESİN SABİTLEMELER
==================================================== */
#gameScreen {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    gap: 15px; 
}

/* --- YATAY SKORBORD KESİN ÇÖZÜMÜ (MOBİLDE BİLE YAN YANA!) --- */
.hud {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-evenly !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 450px !important;
    margin: 10px auto 0 auto !important; 
    padding: 10px 5px !important;
    background: #ffffff !important;
    border: 3px solid #1e272e !important;
    border-radius: 20px !important;
    box-shadow: 0 5px 0 rgba(30, 39, 46, 0.2) !important;
    box-sizing: border-box !important;
}

.score-box {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30% !important;
}

.score-box span:first-child {
    font-size: 0.75rem !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    margin-bottom: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
}

.score-box span:last-child {
    font-size: 1.8rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
}

.red-score { color: #ff4757 !important; }
.blue-score { color: #3498db !important; }

/* --- SÜRE VE KALP ATIŞI ANİMASYONU --- */
.timer-box {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    font-size: 2rem !important;
    font-weight: 900 !important;
    background: #1e272e !important;
    color: #ffde00 !important;
    padding: 5px 15px !important;
    border-radius: 15px !important;
    min-width: 70px !important;
    margin: 0 5px !important;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.5) !important;
}

#gameTimer {
    font-variant-numeric: tabular-nums; 
    display: inline-block;
    transition: color 0.3s ease;
}

.timer-danger {
    color: #ff4757 !important; 
    animation: pulse-danger 0.5s infinite alternate;
}

@keyframes pulse-danger {
    0% { transform: scale(1); text-shadow: 0 0 5px rgba(255, 71, 87, 0.5); }
    100% { transform: scale(1.4); text-shadow: 0 0 15px rgba(255, 71, 87, 1); }
}

/* --- EN DIŞTAKİ ANA OYUN KARTINI (BEYAZ ÇERÇEVE) TAMAMEN SABİTLEME --- */
#cardArea {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#cardArea .game-panel {
    width: 100% !important; 
    max-width: 400px !important; 
    height: auto !important;
    aspect-ratio: 3 / 4.5; /* Daha uzun bir kart oranı, butonlara yer açar */
    min-height: 450px !important; /* Çok küçük ekranlarda butonların sıkışmasını önler */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 15px 15px 20px 15px !important; /* Alt kısımdan ekstra padding */
    box-sizing: border-box !important;
}

/* --- İÇ KART VE KELİMELER --- */
#viewCard {
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.taboo-card {
    background: #fff; 
    padding: 15px; 
    border-radius: 15px;
    border: var(--border-width) solid var(--border-color);
    box-shadow: 6px 6px 0 var(--border-color); 
    margin-bottom: 25px !important; /* Butonlarla arasına kesin mesafe */
    width: 100%;
    flex: 1 1 auto; /* Flex içinde sığması için */
    min-height: 0; /* İçeriğin kartı patlatmasını / butonlara değmesini engeller */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    box-sizing: border-box;
    overflow: hidden;
}

.main-word {
    color: var(--text-dark); 
    font-size: clamp(1.8rem, 6vw, 2.5rem); 
    font-weight: 900; 
    border-bottom: 4px dashed var(--border-color); 
    padding-bottom: 10px; 
    margin: 0 0 15px 0 !important; 
    text-transform: uppercase;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    line-height: 1.1;
    width: 100%;
    word-break: break-word;
}

.forbidden-words {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    flex: 1;
}

.forbidden-words p { 
    font-size: clamp(1.1rem, 4vw, 1.4rem); 
    font-weight: 800; 
    margin: 0; 
    color: var(--danger); 
    text-align: center;
    word-break: break-word;
}

.role-status { border-bottom: 3px dashed #eee; padding-bottom: 10px; text-transform: uppercase; color: #555; width: 100%; text-align: center; font-size: clamp(1rem, 4vw, 1.2rem); }
.describer-info { background: #f1f2f6; padding: 10px; border-radius: 10px; margin-bottom: 15px; font-weight: 800; border: 2px solid var(--border-color); font-size: clamp(0.9rem, 3.5vw, 1rem); }
.motivational-text { font-size: clamp(0.9rem, 3.5vw, 1.1rem); font-weight: 700; color: #777; font-style: italic; text-align: center;}

/* --- OYUN BUTONLARI (KIRILMA YASAK KISMI) --- */
#actionButtons {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: stretch !important;
    gap: 8px !important; 
    width: 100% !important;
    margin-top: auto !important; 
}

#actionButtons button {
    flex: 1 !important; 
    height: auto !important; 
    min-height: 55px !important;
    font-size: clamp(0.7rem, 2.5vw, 0.95rem) !important; 
    font-weight: 900 !important;
    padding: 5px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    line-height: 1.2;
}

#opponentButtons {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: stretch;
    margin-top: auto; 
}

#opponentButtons button {
    width: 100%;
    height: auto !important; 
    min-height: 55px !important;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1rem, 4vw, 1.3rem) !important; 
    padding: 10px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

/* ====================================================
   SOHBET VE MİKROFON ARAÇLARI
==================================================== */
.chat-toggle-btn {
    position: fixed; bottom: 20px; right: 20px; z-index: 9998;
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--blue); color: white; border: var(--border-width) solid var(--border-color);
    font-size: 2rem; cursor: pointer; box-shadow: 4px 4px 0 var(--border-color);
    display: flex; align-items: center; justify-content: center; transition: 0.1s;
}
.chat-toggle-btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 transparent; }

.chat-container {
    position: fixed; bottom: 90px; right: 20px; width: 320px; height: 400px; 
    background: white; border: var(--border-width) solid var(--border-color);
    border-radius: 15px; box-shadow: 6px 6px 0 var(--border-color);
    z-index: 9999; display: flex; flex-direction: column; overflow: hidden;
}
.chat-header {
    background: var(--primary); color: white; padding: 12px;
    font-weight: 900; text-align: center; border-bottom: var(--border-width) solid var(--border-color);
}
.chat-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-messages { flex: 1; padding: 10px; overflow-y: auto; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.msg-me { text-align: right; background: #e0f7fa; padding: 5px 10px; border-radius: 10px; align-self: flex-end; max-width: 80%; }
.msg-other { text-align: left; background: #f1f2f6; padding: 5px 10px; border-radius: 10px; align-self: flex-start; max-width: 80%; }
.chat-input-area {
    display: flex; padding: 10px; background: #f9f9f9;
    border-top: var(--border-width) solid var(--border-color); gap: 5px;
}
.chat-input-area input {
    flex: 1; padding: 8px; border: 2px solid var(--border-color);
    border-radius: 8px; font-family: 'Fredoka', sans-serif; font-weight: 700; outline: none;
}
.chat-send-btn {
    background: var(--success); border: 2px solid var(--border-color);
    border-radius: 8px; padding: 0 15px; font-weight: 900; cursor: pointer;
    box-shadow: 2px 2px 0 var(--border-color);
}
.chat-send-btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 transparent; }

/* Mikrofon */
.voice-floating { position: fixed; bottom: 20px; left: 20px; z-index: 3000; }
.mic-btn {
    width: 60px; height: 60px; border-radius: 50%;
    border: var(--border-width) solid var(--border-color);
    font-size: 1.5rem; cursor: pointer; box-shadow: 4px 4px 0 var(--border-color);
    display: flex; align-items: center; justify-content: center; transition: 0.1s;
}
.mic-on { background: var(--success); } 
.mic-off { background: var(--danger); color: white; }
.mic-btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 transparent; }

/* --- BİLDİRİM (TOAST) --- */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translate(-50%, -150px);
    background: var(--secondary); color: var(--text-dark); padding: 15px 30px;
    font-size: 1.2rem; font-weight: 900; border: var(--border-width) solid var(--border-color);
    border-radius: 12px; box-shadow: 4px 4px 0 var(--border-color);
    z-index: 9999; transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    pointer-events: none; text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

/* --- ANİMASYONLAR --- */
@keyframes popIn {
    0% { opacity: 0; transform: scale(0.8) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ====================================================
   📱 MOBİL & TABLET UYUMU (RESPONSIVE)
==================================================== */
@media (max-width: 768px) {
    body { padding: 10px; }
    
    .game-panel { padding: 20px; width: 95%; box-shadow: 4px 4px 0px var(--border-color); }
    .game-title { font-size: 2.5rem; }
    
    .setup-grid { grid-template-columns: 1fr; gap: 10px; } 
    .team-container { flex-direction: column; } 
    
    /* Mobilde sohbet kutusunu büyüt ve butonun üstüne al */
    .chat-container {
        width: 90vw;
        height: 60vh;
        bottom: 80px; 
        right: 5vw;
    }
    
    /* Alt butonları küçült (Mikrofon ve Chat Toggle) */
    .chat-toggle-btn { width: 50px; height: 50px; bottom: 10px; right: 10px; font-size: 1.5rem; }
    .voice-floating { bottom: 10px; left: 10px; }
    .mic-btn { width: 50px; height: 50px; font-size: 1.2rem; }
    
    #resultScreen h1 { font-size: 3rem; }
    #winnerTeamName { font-size: 2rem; }
    #finalRedScore, #finalBlueScore { font-size: 2.5rem; }
}

#actionButtons.hidden { display: none !important; }
#opponentButtons.hidden { display: none !important; }