/* =========================================
   1. TEMEL AYARLAR VE FONTLAR
   ========================================= */
body {
    font-family: 'Nunito', sans-serif;
    background: #f0e6d2;
    background-image: url("data:image/svg+xml,%3Csvg width='42' height='44' viewBox='0 0 42 44' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='Page-1' fill='none' fill-rule='evenodd'%3E%3Cg id='brick-wall' fill='%23dba352' fill-opacity='0.1'%3E%3Cpath d='M0 0h42v44H0V0zm1 1h40v20H1V1zM0 22h20v20H0V22zm22 0h20v20H22V22z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    margin: 0; min-height: 100vh; display: flex; justify-content: center;
    padding: 20px; color: #2d3436; font-size: 1.1rem; font-weight: 600;
}

.game-title, .input-group-paper input, .input-item-paper input, .btn-paper, 
.game-header-paper .value, #currentLetter, #results h3, .side-note h3,
.voting-header h3, .vote-item span, .game-title span, #toast-notification, 
.timer-badge, #targetRoomCode, .settings-dropdown, .radio-container {
    font-family: 'Nunito', sans-serif !important;
}

.main-container { width: 100%; max-width: 1100px; }
.hidden { display: none !important; }

/* =========================================
   2. KAĞIT KART TASARIMLARI (Defter Teması)
   ========================================= */
.paper-card {
    background-color: #fffcf0; box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    padding: 30px; position: relative; border-radius: 4px;
}
.intro-card {
    max-width: 500px; margin: 50px auto; text-align: center;
    border: 2px solid #e0d7c6; transform: rotate(-1deg);
}

.game-layout-wrapper { display: flex; gap: 25px; align-items: flex-start; }

.main-paper {
    flex: 3;
    /* Defter Çizgileri */
    background-image: linear-gradient(#e1e1e1 1px, transparent 1px), linear-gradient(90deg, #ff7675 2px, transparent 2px);
    background-size: 100% 2.5rem, 100% 100%; 
    background-position: 0 1.5rem, 40px 0;
    padding: 40px 40px 40px 60px; /* Soldaki pembe çizgi payı (60px) */
    box-shadow: 5px 5px 15px rgba(0,0,0,0.2);
    transform: rotate(-0.5deg); 
    min-height: 600px;
}

.side-note {
    flex: 1; min-width: 200px; background-color: #fffde7;
    border: 1px solid #e6e6e6; box-shadow: 3px 3px 10px rgba(0,0,0,0.15);
    transform: rotate(1.5deg); text-align: center; border-top: 5px solid rgba(255, 234, 167, 0.5);
}

/* =========================================
   3. HEADER VE AYARLAR MENÜSÜ
   ========================================= */
.game-header-paper { display: flex; align-items: center; margin-bottom: 30px; position: relative; }
.game-header-paper .label { font-size: 1.5rem; font-weight: 800; }
.game-header-paper .value { font-size: 1.8rem; color: #d63031; margin-left: 10px; transform: rotate(-2deg); font-weight: 800;}

.btn-mic-paper {
    margin-left: 10px; background: white; border: 2px solid #c0392b; color: #c0392b;
    border-radius: 50%; width: 45px; height: 45px; cursor: pointer; transition: 0.2s;
    display: flex; justify-content: center; align-items: center; font-size: 1.2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.btn-mic-paper:hover { transform: scale(1.1); }
.btn-mic-paper.active {
    border-color: #27ae60; color: #27ae60; background-color: #eafaf1;
    animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
    0% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(39, 174, 96, 0); }
    100% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0); }
}

.btn-copy-paper {
    margin-left: 10px; margin-right: 10px; background: none; border: 2px solid #b2bec3;
    border-radius: 50%; width: 40px; height: 40px; cursor: pointer; color: #636e72;
    transition: 0.2s; display: flex; justify-content: center; align-items: center;
}
.btn-copy-paper:hover { background: #dfe6e9; color: #2d3436; }

.settings-wrapper { margin-left: auto; position: relative; z-index: 200; }
.settings-wrapper-inline { text-align: left; margin-bottom: 15px; background: rgba(255,255,255,0.4); padding: 10px; border-radius: 8px; }
.settings-wrapper-inline p { margin: 0 0 5px 0; font-size: 0.9rem; font-weight: bold; color: #636e72; }
.radio-group { display: flex; gap: 15px; }

.public-rooms-area { margin-top: 30px; border-top: 2px dashed #b2bec3; padding-top: 20px; }
.public-rooms-area h3 { font-size: 1.5rem; margin-bottom: 15px; color: #2d3436; }
.rooms-list-box { max-height: 200px; overflow-y: auto; background: rgba(255, 255, 255, 0.5); border: 1px solid #b2bec3; border-radius: 8px; padding: 10px; }
.room-item { display: flex; justify-content: space-between; align-items: center; background: white; padding: 10px; margin-bottom: 8px; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); transition: transform 0.2s; }
.room-item:hover { transform: scale(1.02); }
.room-name { font-weight: bold; font-size: 1.1rem; color: #2d3436; }
.room-count { font-size: 0.9rem; color: #636e72; margin-right: 10px; }
.join-room-btn { background: #27ae60; color: white; border: none; padding: 5px 12px; border-radius: 20px; cursor: pointer; font-weight: bold; font-size: 0.9rem; }
.join-room-btn:hover { background: #219150; }

.settings-icon { cursor: pointer; color: #636e72; font-size: 1.5rem; padding: 8px; border-radius: 50%; background: rgba(255,255,255,0.5); border: 2px solid #b2bec3; transition: 0.2s; width: 45px; height: 45px; display: flex; justify-content: center; align-items: center; }
.settings-icon:hover { background: white; color: #2d3436; transform: rotate(90deg); }
.settings-dropdown { position: absolute; top: 55px; right: 0; background: white; border: 2px solid #2d3436; border-radius: 10px; padding: 15px; width: 260px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); text-align: left; }
.settings-dropdown::after { content: ""; position: absolute; bottom: 100%; right: 15px; border-width: 10px; border-style: solid; border-color: transparent transparent #2d3436 transparent; }

.radio-container { display: block; position: relative; padding-left: 30px; margin-bottom: 12px; cursor: pointer; font-size: 1rem; color: #2d3436; user-select: none; font-weight: bold; }
.radio-container input { position: absolute; opacity: 0; cursor: pointer; }
.radio-checkmark { position: absolute; top: 0; left: 0; height: 20px; width: 20px; background-color: #eee; border-radius: 50%; border: 2px solid #b2bec3; }
.radio-container:hover input ~ .radio-checkmark { background-color: #ccc; }
.radio-container input:checked ~ .radio-checkmark { background-color: #27ae60; border-color: #27ae60; }
.radio-checkmark:after { content: ""; position: absolute; display: none; top: 5px; left: 5px; width: 6px; height: 6px; border-radius: 50%; background: white; }
.radio-container input:checked ~ .radio-checkmark:after { display: block; }

/* =========================================
   4. OYUN ALANI (HARF & ZAMANLAYICI)
   ========================================= */
.letter-box-paper { width: 100px; height: 100px; margin: 10px auto; border: 4px solid #d63031; border-radius: 50% 45% 55% 40% / 45% 55% 40% 50%; display: flex; align-items: center; justify-content: center; transform: rotate(3deg); }
#currentLetter { font-size: 5rem; color: #d63031; margin: 0; line-height: 1; font-weight: 900; }
.timer-badge { position: absolute; top: 0; right: 20px; background: #2d3436; color: white; width: 60px; height: 60px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 1.8rem; box-shadow: 2px 2px 5px rgba(0,0,0,0.2); transition: all 0.3s; border: 3px solid #b2bec3; z-index: 10; }
.timer-badge.overtime { background: #e67e22; border-color: #d35400; animation: pulse 1s infinite; }
.timer-badge.panic { background: #d63031; border-color: #c0392b; transform: scale(1.2); animation: shake 0.5s infinite; }

/* =========================================
   5. INPUTLAR VE BUTONLAR (Kusursuz Grid)
   ========================================= */
.inputs-grid-paper { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 20px; 
    margin: 30px 0; 
}
.input-item-paper label { display: block; font-weight: 800; color: #d63031; font-size: 1.1rem; margin-bottom: 5px; }

.input-group-paper { margin-bottom: 20px; }
.input-group-paper input, .input-item-paper input { 
    width: 100%; 
    background: transparent; 
    border: none; 
    border-bottom: 2px dashed #b2bec3; 
    padding: 8px 5px; 
    font-size: 1.3rem; 
    color: #2d3436; 
    font-weight: 700; 
    box-sizing: border-box; /* Taşmaları engeller */
}
.input-group-paper input { text-align: center; } /* Sadece ana menü inputları ortalı */
.input-item-paper input { text-align: left; } /* Oyun içi kelime girişleri sola dayalı */

.input-group-paper input:focus, .input-item-paper input:focus { 
    outline: none; 
    border-bottom: 2px solid #6c5ce7; 
}

/* Şık Butonlar */
.btn-paper { 
    width: 100%; padding: 12px; border: 2px solid #2d3436; background: transparent; 
    font-size: 1.4rem; cursor: pointer; margin-bottom: 10px; transform: rotate(-1deg); 
    transition: 0.2s; box-shadow: 3px 3px 0 rgba(0,0,0,0.2); font-weight: 800; box-sizing: border-box;
}
.btn-paper:hover { transform: rotate(0deg) scale(1.02); }
.btn-paper:active { box-shadow: none; transform: translate(3px, 3px); }
.btn-paper:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }
.btn-blue { color: #0984e3; border-color: #0984e3; }
.btn-yellow { color: #d35400; border-color: #d35400; }
.btn-green { color: #27ae60; border-color: #27ae60; }
.btn-red { color: #c0392b; border-color: #c0392b; }
.btn-link { background: none; border: none; text-decoration: underline; cursor: pointer; color: #636e72; font-size: 1.1rem; text-align: center;}

/* =========================================
   6. OYLAMA VE PUANLAMA
   ========================================= */
#voting-section { margin-top: 30px; border-top: 2px dashed #b2bec3; padding-top: 20px; animation: fadeIn 0.5s; }
.voting-header h3 { font-size: 2rem; margin: 0 0 10px 0; color: #2d3436; font-weight: 900; }
.voting-list { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.vote-item { background: rgba(255, 255, 255, 0.6); border: 1px solid #dfe6e9; padding: 12px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; font-size: 1.3rem; transition: all 0.2s; }
.vote-info { display: flex; flex-direction: column; align-items: flex-start; }
.vote-info strong { font-size: 0.9rem; color: #636e72; margin-bottom: 2px; }
.vote-action { padding: 8px; background: rgba(255,255,255,0.9); border-radius: 50%; width: 35px; height: 35px; display: flex; justify-content: center; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); transition: transform 0.2s; }
.vote-action:active { transform: scale(0.9); }
.rejected-answer { background-color: #ffdad9 !important; border-color: #ff7675 !important; }

/* =========================================
   7. BİLDİRİM VE ANİMASYONLAR
   ========================================= */
#toast-notification { visibility: hidden; min-width: 280px; background-color: #d63031; color: #fff; text-align: center; border-radius: 50px; padding: 16px 24px; position: fixed; z-index: 1000; left: 50%; bottom: 30px; transform: translateX(-50%); font-size: 1.3rem; box-shadow: 0 4px 15px rgba(0,0,0,0.3); opacity: 0; transition: opacity 0.5s, bottom 0.5s; }
#toast-notification.show { visibility: visible; opacity: 1; bottom: 50px; }

@keyframes bounceIn { 0% { opacity: 0; transform: scale(0.3); } 50% { opacity: 1; transform: scale(1.05); } 70% { transform: scale(0.9); } 100% { transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes shake { 0% { transform: scale(1.2) rotate(0deg); } 25% { transform: scale(1.2) rotate(5deg); } 75% { transform: scale(1.2) rotate(-5deg); } 100% { transform: scale(1.2) rotate(0deg); } }

/* --- DİNAMİK KATEGORİ ETİKETLERİ VE MODAL --- */
.category-tags-container { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; margin-top: 10px; }
.category-tag { background: #dfe6e9; color: #2d3436; padding: 4px 10px; border-radius: 15px; font-size: 0.85rem; font-weight: 800; display: flex; align-items: center; gap: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.category-tag .remove-btn { color: #d63031; cursor: pointer; font-size: 0.9rem; transition: transform 0.2s; }
.category-tag .remove-btn:hover { transform: scale(1.2); }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 2000; display: flex; justify-content: center; align-items: center; }
.modal-content { width: 90%; max-width: 450px; transform: rotate(0deg) !important; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }


/* =========================================
   8. MOBİL OPTİMİZASYON (TEMİZLENMİŞ)
   ========================================= */
@media (max-width: 768px) {
    body { padding: 10px; } /* Mobilde ekranı genişletir */
    
    .game-layout-wrapper { flex-direction: column; }
    
    /* Defter Görünümü Mobilde Ezilmesin Diye Koruma */
    .main-paper { 
        padding: 20px 20px 20px 40px !important; /* Soldaki 40px pembe çizgiyi korur */
        min-height: auto;
        transform: rotate(0deg); /* Mobilde düz dursun yer kaplamasın */
    }
    
    /* Grid'i Tek Sütuna Düşür */
    .inputs-grid-paper { 
        grid-template-columns: 1fr; 
        gap: 15px;
    }
    
    /* Üst Menü Düzenlemesi */
    .game-header-paper {
        flex-direction: column;
        align-items: center !important;
        gap: 15px;
    }
    
    .user-list-horizontal { justify-content: center; }
    
    .timer-badge { right: 0; top: -10px; width: 50px; height: 50px; font-size: 1.2rem; }
    
    .btn-paper { font-size: 1.2rem; }
    
    /* Oylama Menüsü Mobilde Yan Yana Sıkışmasın */
    .voting-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .letter-box-paper { width: 80px; height: 80px; }
    #currentLetter { font-size: 3.5rem; }
    .input-item-paper input { font-size: 1.1rem; }
}

/* =========================================
   OYUN KARTINI TAM ORTALAMA VE GENİŞLETME
   ========================================= */
@media (max-width: 768px) {
    .main-container {
        display: flex;
        justify-content: center;
        width: 100%;
    }
    
    .game-layout-wrapper {
        width: 100%;
        align-items: center !important; /* Çerçeveyi yatayda tam ortaya kilitler */
    }
    
    .main-paper {
        width: 100% !important; /* Sağdaki boşluğu doldurur */
        max-width: 500px !important; /* Çok da uzayıp çirkinleşmesini önler */
        margin: 0 auto !important; /* Kartı sağdan ve soldan eşit boşlukla ortalar */
        box-sizing: border-box !important; /* Paddinglerin taşımasını engeller */
    }
}

/* Iframe İçi Mobil Düzeltmeleri */
@media (max-width: 768px) {
    body { 
        padding: 0 !important; 
        margin: 0 !important; 
    }
    .main-container { 
        padding: 10px; 
        box-sizing: border-box; 
    }
    .main-paper { 
        margin-bottom: 70px !important; /* Alttaki mor butona alan bırakır, butonları ezmez */
        transform: rotate(0deg) !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}