:root {
    /* --- VINTAGE CARTOON PALET --- */
    --paper: #e8dcc0;  /* Sıcak eski kağıt rengi */
    --ink: #181818;    /* Siyah Kontur */
    --red: #d62828;    /* Retro Kırmızı */
    --yellow: #fcbf49; /* Show Sarısı */
    --blue: #1d3557;   /* Derin Mavi */
    --white: #ffffff;
    
    /* Fontlar */
    --font-title: 'Bangers', cursive;
    --font-hand: 'Patrick Hand', cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-hand);
    background-color: var(--paper);
    color: var(--ink);
    
    /* 1. Yükseklik kilidini açtık (min-height yaptık) */
    min-height: 100vh;
    height: auto !important; 
    
    /* 2. Kaydırmayı aktifleştirdik */
    overflow-y: auto !important; 
    overflow-x: hidden;
    
    /* 3. İçeriklerin üst üste binmemesi için esnek yapı */
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: flex-start; /* 'center' yerine 'flex-start' yaptık ki sayfa yukarıdan başlasın */
    
    /* 4. Alt kısımda Lobi Butonu için boşluk bıraktık */
    padding: 20px 20px 100px 20px; 
    position: relative;
}

/* --- ARKA PLAN EFEKTLERİ --- */
.bg-paper-texture {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.10'/%3E%3C/svg%3E");
    z-index: -5; pointer-events: none;
}

.bg-sunburst-rotate {
    position: fixed; top: -50%; left: -50%; width: 200%; height: 200%;
    background: repeating-conic-gradient(
        from 0deg,
        transparent 0deg 15deg,
        rgba(212, 197, 163, 0.4) 15deg 30deg
    );
    z-index: -4;
    animation: spinBackground 30s linear forwards;
    pointer-events: none;
}
@keyframes spinBackground { from { transform: rotate(0deg); } to { transform: rotate(180deg); } }

.bg-floating-dust {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        radial-gradient(var(--ink) 1px, transparent 1px),
        radial-gradient(rgba(0,0,0,0.2) 2px, transparent 2px);
    background-size: 100px 100px, 200px 200px;
    background-position: 0 0, 50px 50px;
    z-index: -3; opacity: 0.1;
    animation: floatDust 30s linear infinite;
    pointer-events: none;
}
@keyframes floatDust { 0% { background-position: 0 0, 50px 50px; } 100% { background-position: 100px 200px, 150px 250px; } }

.bg-film-scratch {
    position: fixed; top: 0; left: 15%; width: 2px; height: 100%;
    background: rgba(0,0,0,0.1); z-index: -2;
    animation: scratchFlicker 4s infinite; pointer-events: none;
}
@keyframes scratchFlicker {
    0%, 100% { opacity: 0; }
    5% { opacity: 0.5; transform: translateX(20px); }
    40% { opacity: 0; transform: translateX(300px); }
    42% { opacity: 0.3; transform: translateX(320px); }
}

.bg-vignette-pulse {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, transparent 50%, rgba(26, 26, 26, 0.4) 150%);
    z-index: -1; pointer-events: none;
    animation: vignettePulse 5s ease-in-out infinite alternate;
}
@keyframes vignettePulse { from { opacity: 0.5; } to { opacity: 1; } }

/* --- CONTAINER --- */
.container { width: 100%; max-width: 460px; z-index: 10; position: relative; }

/* --- BAŞLIK ALANI --- */
.toon-header {
    position: relative; text-align: center; margin-bottom: 30px;
    display: flex; flex-direction: column; align-items: center;
    animation: titleFloat 4s ease-in-out infinite;
}
@keyframes titleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.title-wrapper { position: relative; z-index: 2; }

.toon-title {
    font-family: var(--font-title);
    font-size: 4.5rem; 
    color: var(--red);
    margin: 0; line-height: 0.85;
    text-shadow: 3px 3px 0 var(--white), 6px 6px 0 var(--ink);
    -webkit-text-stroke: 2.5px var(--ink);
    letter-spacing: 2px;
}

.toon-subtitle-banner {
    background: var(--yellow);
    border: 3px solid var(--ink);
    display: inline-block;
    padding: 2px 30px;
    box-shadow: 5px 5px 0 var(--ink);
    border-radius: 30% 30% 10% 10% / 10% 10% 30% 30%;
    margin-top: -5px;
}
.toon-subtitle-banner span {
    font-family: var(--font-title); font-size: 2.2rem; color: var(--ink); text-shadow: none;
}

/* --- KAĞIT KART (PANEL) --- */
.paper-card {
    background-color: #fdf6e3;
    border: 4px solid var(--ink);
    border-radius: 12px;
    padding: 40px 30px; /* İç boşluk artırıldı */
    position: relative;
    box-shadow: 12px 12px 0 rgba(0,0,0,0.15);
}

.pin {
    position: absolute; top: -12px; width: 20px; height: 20px;
    background: var(--red); border: 2px solid var(--ink); border-radius: 50%;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.3); z-index: 5;
}
.pin.top-left { left: 15px; }
.pin.top-right { right: 15px; }

/* Mikrofon Bilgisi */
#micInfo {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: #555;
    border-bottom: 2px dashed rgba(0,0,0,0.1);
    padding-bottom: 10px;
    width: 100%;
}

/* --- INPUTLAR --- */
.input-wrap { 
    margin-bottom: 15px; 
    text-align: left; 
}

.input-wrap label {
    font-family: var(--font-title); 
    font-size: 1.4rem; 
    color: var(--ink);
    display: block; 
    margin-bottom: 8px; /* Başlık ile kutu arası açıldı */
    margin-left: 5px;
}

input[type="text"] {
    width: 100%; 
    padding: 14px;
    background: #fff; 
    border: 3px solid var(--ink);
    border-radius: 8px;
    font-family: var(--font-hand); 
    font-size: 1.3rem; font-weight: bold;
    color: var(--ink); 
    outline: none;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
    transition: 0.2s;
    margin-bottom: 15px; /* !!! ÖNEMLİ: Kutular birbirine yapışmasın diye boşluk */
}
/* Son inputun altındaki boşluğu sıfırla (input-wrap hallediyor) */
.input-wrap input[type="text"]:last-child {
    margin-bottom: 0;
}

input[type="text"]:focus { transform: scale(1.02); box-shadow: 6px 6px 0 var(--ink); }

/* --- BUTONLAR --- */
.btn-toon {
    width: 100%; padding: 14px;
    font-family: var(--font-title); font-size: 1.6rem; letter-spacing: 1px;
    border: 3px solid var(--ink); border-radius: 8px;
    cursor: pointer; transition: 0.1s;
    box-shadow: 6px 6px 0 var(--ink);
    margin-top: 10px; /* Buton ile üstteki eleman arasına boşluk */
    text-transform: uppercase;
    position: relative; top: 0; left: 0;
    background-image: linear-gradient(45deg, rgba(255,255,255,0.1) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.1) 75%, transparent 75%, transparent);
    background-size: 10px 10px;
}
.btn-toon:hover { transform: translateY(-2px); }
.btn-toon:active { top: 5px; left: 5px; box-shadow: 0 0 0 var(--ink); transform: translateY(0); }

.btn-toon.primary { background-color: var(--blue); color: var(--white); }
.btn-toon.secondary { background-color: var(--white); color: var(--ink); border-style: solid; }
.btn-toon.warning { background-color: var(--yellow); color: var(--ink); }
.btn-toon.success { background-color: #2a9d8f; color: var(--white); }
.btn-toon.danger { background-color: var(--red); color: var(--white); }

.divider-toon { text-align: center; margin: 25px 0; font-family: var(--font-title); font-size: 1.3rem; }
.divider-toon span { 
    background: var(--ink); color: var(--white); 
    padding: 4px 15px; border-radius: 20px; 
    display: inline-block; border: 2px solid var(--white);
}

/* --- OYUN EKRANI --- */
.ticket-stub {
    background: #fff; border: 2px dashed var(--ink); padding: 12px 15px;
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; cursor: pointer;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
}
.stub-label { font-weight: bold; font-family: var(--font-title); font-size: 1.1rem; }
.stub-code { font-family: 'Bangers'; font-size: 2rem; color: var(--red); letter-spacing: 2px; text-decoration: underline; }

.host-note {
    background: #fffae6; border: 2px solid var(--ink); padding: 15px;
    margin-bottom: 15px; position: relative;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
}
.host-note::after { content:''; position:absolute; top:-5px; right:-5px; width:40px; height:40px; background:rgba(0,0,0,0.05); border-radius:50%; z-index:1; }
.note-title { font-family: var(--font-title); border-bottom: 2px solid var(--ink); margin-bottom: 8px; font-size: 1.3rem; position:relative; z-index:2; }

.word-box {
    background: var(--ink); color: var(--white);
    border-radius: 12px; padding: 30px 10px;
    text-align: center; margin-bottom: 20px;
    border: 4px solid var(--white);
    box-shadow: 0 0 0 4px var(--ink), 10px 10px 0 rgba(0,0,0,0.2);
    animation: pulseBox 3s infinite ease-in-out;
}
@keyframes pulseBox { 0% { transform: scale(1); } 50% { transform: scale(1.03); } 100% { transform: scale(1); } }

#wordDisplay { font-family: var(--font-title); font-size: 3.5rem; letter-spacing: 3px; text-shadow: 3px 3px 0 #444; }
#info { color: var(--yellow); font-size: 1.2rem; margin-top: 5px; font-weight: bold; }

.input-row { display: flex; gap: 8px; }
.btn-circle {
    width: 55px; height: 55px; background: #2a9d8f; border: 3px solid var(--ink);
    border-radius: 50%; cursor: pointer; font-size: 1.5rem; color: var(--white);
    box-shadow: 4px 4px 0 var(--ink); transition: 0.1s;
    display: flex; align-items: center; justify-content: center;
}
.btn-circle:active { transform: translate(3px, 3px); box-shadow: none; }

/* Liste */
.cast-list h4 { font-family: var(--font-title); border-bottom: 3px solid var(--ink); margin-bottom: 10px; font-size: 1.4rem; letter-spacing: 1px; }
#playerList li {
    list-style: none; padding: 10px; margin-bottom: 8px;
    background: rgba(255,255,255,0.6); border: 2px solid var(--ink); border-radius: 6px;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 1.2rem; font-weight: bold; box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
#playerList li.active-turn {
    background: var(--yellow); border: 3px solid var(--ink);
    transform: scale(1.03);
    box-shadow: 5px 5px 0 rgba(0,0,0,0.2);
}
.player-avatar { font-size: 1.6rem; margin-right: 10px; color: var(--ink); }

/* Popup */
#setupArea { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(26, 26, 26, 0.9); z-index: 100; display: flex; align-items: center; justify-content: center; }
.popup-card { width: 90%; max-width: 400px; background: var(--paper); box-shadow: 20px 20px 0 var(--ink); }
.btn-row { display: flex; gap: 10px; }

/* Diğer */
.hidden { display: none !important; }
.flex-show { display: flex !important; }
#toast {
    visibility: hidden; min-width: 250px; background: var(--ink); color: var(--white);
    border: 3px solid var(--white); border-radius: 20px; padding: 15px;
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 2000;
    font-family: var(--font-hand); font-size: 1.3rem; text-align: center; box-shadow: 5px 5px 10px rgba(0,0,0,0.3);
}
#toast.show { visibility: visible; animation: popUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), fadeOut 0.5s 2.5s forwards; }
@keyframes popUp { from { bottom: 0; transform: translateX(-50%) scale(0); } to { bottom: 30px; transform: translateX(-50%) scale(1); } }
@keyframes fadeOut { to { opacity: 0; visibility: hidden; } }

/* Sonuçlar - SIKIŞIKLIK GİDERİLDİ */
#resultsArea { 
    border: 4px solid var(--ink); 
    padding: 25px; 
    background: var(--white); 
    transform: rotate(-1deg); 
    margin-top: 20px; 
    margin-bottom: 30px; /* <-- BURASI ARTIRILDI (Eskiden yoktu veya azdı) */
    text-align: center; 
    box-shadow: 10px 10px 0 rgba(0,0,0,0.2); 
}
/* Diğer win/lose stilleri aynen kalabilir */
#resultsArea.win { background: #d4edda; color: #155724; border-color: #155724; }
#resultsArea.lose { background: #f8d7da; color: #721c24; border-color: #721c24; }

#cluesArea { margin-top: 20px; max-height: 150px; overflow-y: auto; background: #fff; border: 2px solid var(--ink); padding: 10px; font-family: var(--font-hand); font-weight: bold; font-size: 1.1rem; }

/* --- POPUP VE Z-INDEX DÜZELTMESİ --- */

/* Hem Ayarlar hem de Public Oda Listesi için ortak kapsayıcı */
#setupArea, #publicRoomsArea, #nameInputModal, #moleGuessModal {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999 !important; /* En önde olması için */
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

/* Popup Kartının Kendisi */
.popup-card {
    width: 90%;
    max-width: 420px;
    background-color: var(--paper);
    border: 4px solid var(--ink);
    border-radius: 12px;
    padding: 40px 30px;
    box-shadow: 20px 20px 0 rgba(0,0,0,0.4); /* Gölgeyi belirginleştirdik */
    transform: rotate(-2deg) scale(1); /* Hafif yamukluk tarz katar */
    position: relative;
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.8) rotate(-5deg); opacity: 0; }
    to { transform: scale(1) rotate(-2deg); opacity: 1; }
}

/* Liste İçeriği */
#roomsList {
    max-height: 300px;
    overflow-y: auto;
    margin: 15px 0;
    border: 2px dashed var(--ink);
    background: #fff;
    padding: 10px;
    border-radius: 8px;
}

/* Odalar Listesindeki Kartlar */
#roomsList .ticket-stub {
    margin-bottom: 10px;
    transform: rotate(0deg); /* Liste içindekiler düz dursun */
    box-shadow: 3px 3px 0 rgba(0,0,0,0.1);
    border-width: 2px;
}

/* --- POPUP VE Z-INDEX DÜZELTMESİ --- */

/* BURAYA #nameInputModal EKLEDİK */
#setupArea, #publicRoomsArea, #nameInputModal {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

/* Diğer stiller aynı kalıyor... */
/* Popup Kartının Kendisi */
.popup-card {
    width: 90%;
    max-width: 420px;
    background-color: var(--paper);
    border: 4px solid var(--ink);
    border-radius: 12px;
    padding: 40px 30px;
    box-shadow: 20px 20px 0 rgba(0,0,0,0.4);
    transform: rotate(-2deg) scale(1);
    position: relative;
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
/* ...devamı... */
/* --- [YENİ] OYUN EKRANI DÜZENİ (Çift Sütun) --- */

/* Oyun ekranı için container genişliğini artır */
.game-wide-mode {
    max-width: 1000px !important; /* Normalde 460px idi, şimdi geniş */
}

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

/* Sol Panel (Ana Kart) */
.main-game-card {
    flex: 1.2; /* Sol taraf biraz daha geniş */
    min-width: 300px;
}

/* Sağ Panel (Not Defteri) */
.notebook-panel {
    flex: 1;
    background: #fff; /* Beyaz kağıt */
    border: 3px solid var(--ink);
    border-radius: 5px 15px 15px 5px;
    padding: 20px;
    position: relative;
    box-shadow: 10px 10px 0 rgba(0,0,0,0.15);
    background-image: radial-gradient(#e0e0e0 1px, transparent 1px); /* Noktalı kağıt deseni */
    background-size: 20px 20px;
    transform: rotate(-1deg); /* Hafif yamukluk */
}

/* Spiral Cilt Süslemesi */
.spiral-binding {
    position: absolute;
    left: -15px; top: 20px; bottom: 20px; width: 20px;
    background-image: radial-gradient(circle at 0% 50%, #333 4px, transparent 5px);
    background-size: 10px 30px;
    background-repeat: repeat-y;
}

.notebook-title {
    font-family: var(--font-title);
    font-size: 1.8rem;
    text-align: center;
    border-bottom: 3px solid var(--red);
    padding-bottom: 10px;
    margin-bottom: 20px;
    color: var(--ink);
}

/* Oylama Alanı Düzeni */
.vote-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* İkişerli yan yana */
    gap: 10px;
    margin-bottom: 20px;
}

/* İpucu Günlüğü */
.log-container {
    background: rgba(255, 249, 196, 0.6); /* Sarımsı not kağıdı */
    border: 2px solid var(--ink);
    padding: 10px;
    border-radius: 5px;
}
.log-header {
    font-family: var(--font-title);
    font-size: 1.2rem;
    text-decoration: underline;
    margin-bottom: 10px;
    color: var(--blue);
}

/* İpuçları Alanını Güncelle */
#cluesArea {
    margin-top: 0;
    max-height: 300px; /* Daha uzun olabilir artık */
    overflow-y: auto;
    background: transparent;
    border: none;
    padding: 0;
    font-size: 1.1rem;
}
#cluesArea p {
    border-bottom: 1px dashed #999;
    padding: 8px 0;
    margin: 0;
}

/* MOBİL UYUM (Responsive) */
@media (max-width: 850px) {
    .game-layout {
        flex-direction: column; /* Mobilde alt alta */
    }
    .main-game-card, .notebook-panel {
        width: 100%;
        transform: rotate(0deg); /* Mobilde düz dursun */
    }
    .spiral-binding { display: none; } /* Mobilde spirali gizle */
}
/* --- YENİ SES KONTROLLERİ VE MİKROFON --- */

/* Kontrol Paneli (Mikrofon Butonunun Durduğu Yer) */
.control-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.mic-label {
    font-family: var(--font-title);
    font-size: 1rem;
    margin-top: 5px;
    color: var(--ink);
}

/* Kare İkon Buton (Mic İçin) */
.btn-toon.icon-only {
    width: 60px; height: 60px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
    border-radius: 50%; /* Yuvarlak */
    background: #5cb85c; /* Varsayılan Yeşil (Açık) */
    color: #fff;
    transition: 0.2s;
}

/* Mikrofon Kapalı Durumu (JS ile eklenecek class) */
.btn-toon.icon-only.muted {
    background: var(--red); /* Kırmızı */
    color: #fff;
}

/* --- RETRO SES SLIDER TASARIMI (Custom Range) --- */

/* Slider'ın genel yapısı */
input[type=range].toon-range {
    -webkit-appearance: none; /* Varsayılanı gizle */
    width: 100%;
    margin: 5px 0;
    background: transparent;
}

input[type=range].toon-range:focus {
    outline: none;
}

/* Çubuk (Track) */
input[type=range].toon-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 12px;
    cursor: pointer;
    background: #fff;
    border: 3px solid var(--ink);
    border-radius: 6px;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

/* Başlık (Thumb - Yuvarlak Kısım) */
input[type=range].toon-range::-webkit-slider-thumb {
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: var(--red);
    border: 3px solid var(--ink);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -9px; /* Ortalamak için */
    box-shadow: 1px 1px 0 rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

input[type=range].toon-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Firefox için uyumluluk */
input[type=range].toon-range::-moz-range-track {
    width: 100%;
    height: 12px;
    cursor: pointer;
    background: #fff;
    border: 3px solid var(--ink);
    border-radius: 6px;
}
input[type=range].toon-range::-moz-range-thumb {
    height: 24px;
    width: 24px;
    border: 3px solid var(--ink);
    border-radius: 50%;
    background: var(--red);
    cursor: pointer;
}

/* Oyuncu Listesindeki Ses Alanı Düzeni */
.audio-control-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.5);
    padding: 2px 8px;
    border-radius: 15px;
    border: 2px solid var(--ink);
}

/* --- LİSTE İÇİNDEKİ BOZUK BUTONU DÜZELTME --- */

/* Liste kutusunun içindekileri yan yana hizala */
.ticket-stub {
    display: flex;             
    justify-content: space-between; 
    align-items: center;       
    gap: 10px; /* Yazı ile buton arası boşluk */
}

/* Liste içindeki butonu küçült ve hizala */
.ticket-stub .btn-toon {
    width: auto !important;   /* Tam genişliği iptal et */
    margin: 0 !important;     /* Gereksiz boşlukları sil */
    padding: 5px 15px;        /* Butonu biraz kibarlaştır */
    font-size: 1rem;          /* Yazı boyutunu listeye uydur */
    flex-shrink: 0;           /* Butonun ezilmesini engelle */
}