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

/* 1. KURAL: Tarayıcının ana çubuğunun (sağdaki ana scroll) çıkmasını kesinlikle engelliyoruz (SEO sonrası overflow serbest) */
html, body { min-height: 100vh; overflow-y: auto; overflow-x: hidden; }

body {
    font-family: 'Poppins', sans-serif;
    background: radial-gradient(circle at top left, var(--bg-navy), var(--bg-deep) 80%);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(0.5rem, 2vw, 1rem);
    padding-bottom: 0;
}

.hidden { display: none !important; }
.disabled { opacity: 0.5; pointer-events: none; cursor: not-allowed !important; filter: grayscale(50%); }
.mt-auto { margin-top: auto; }

.view-state { display: flex; flex-direction: column; height: 100%; animation: fadeIn 0.4s ease; min-height: 0; overflow: hidden; }
.view-state:not(.active) { display: none; }

#login-screen { justify-content: flex-start; align-items: center; overflow-y: auto; overflow-x: hidden; width: 100%; }

/* SEO ve Kurallar Bolumu */
.hero-content { text-align: center; max-width: 600px; margin-bottom: 2rem; }
.seo-description { color: var(--text-muted); font-size: clamp(0.95rem, 2vw, 1.1rem); line-height: 1.6; margin-top: -1rem; margin-bottom: 1rem; }

.seo-rules-container { width: 100%; max-width: 800px; margin-top: auto; padding-top: 2rem; border-top: 1px solid var(--btn-secondary-bg); text-align: center; overflow-y: visible; }
.seo-rules-container h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); margin-bottom: 1.5rem; color: var(--text-main); }

.rules-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; text-align: left; padding-bottom: 20px; }

@media (max-width: 600px) {
    .rules-grid { grid-template-columns: 1fr; }
}

h1, h2, h3 { color: var(--lilac); margin-bottom: clamp(0.6rem, 1.5vw, 1rem); letter-spacing: 0.5px; }

.gradient-text {
    background: linear-gradient(45deg, var(--lilac), var(--neon-purple));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    font-weight: 800; text-align: center; margin-bottom: clamp(1.2rem, 3vw, 2.5rem);
}


.category-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 0.4rem; overflow-y: auto; max-height: 150px; padding-right: 5px; }
.category-pill {
    background: var(--input-bg); border: 1px solid var(--lilac-muted); border-radius: 20px;
    padding: clamp(6px, 1.5vw, 8px) clamp(12px, 2.5vw, 16px);
    font-size: clamp(0.8rem, 2vw, 0.85rem); font-weight: 600;
    color: var(--text-muted); cursor: pointer; transition: all 0.2s ease; user-select: none;
    display: inline-flex; align-items: center;
}
.category-pill input[type="checkbox"] { display: none; }
.category-pill:has(input:checked) { background: rgba(var(--primary-rgb), 0.4); border-color: var(--neon-purple); color: var(--text-main); box-shadow: 0 4px 10px var(--header-bg); }


.lobby-header { display: flex; justify-content: center; align-items: center; gap: clamp(0.8rem, 2vw, 1.2rem); margin-bottom: clamp(1rem, 2.5vw, 2rem); background: var(--card-bg); padding: clamp(0.6rem, 1.5vw, 1rem); border-radius: 15px; flex-wrap: wrap; flex-shrink: 0; }
.code-container { display: flex; align-items: center; gap: 10px; background: var(--code-bg); padding: 6px 14px; border-radius: 10px; }

.lobby-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: clamp(1rem, 2.5vw, 2rem);
    flex-grow: 1; min-height: 0; overflow-y: auto;
}


.players-panel ul { list-style: none; overflow-y: auto; flex-grow: 1; padding-right: 5px; margin-top: 10px; }
.players-panel li { padding: 10px 12px; margin-bottom: 8px; background: var(--item-bg); border-radius: 8px; border-left: 3px solid var(--lilac); display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; transition: background 0.2s; font-size: 0.95rem; }
.players-panel li:hover { background: var(--item-hover-bg); }

.game-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: clamp(0.8rem, 2vw, 1.5rem); padding: clamp(0.6rem, 1.5vw, 1rem) clamp(0.8rem, 2vw, 1.5rem); flex-wrap: wrap; gap: 0.8rem; background: var(--card-bg); flex-shrink: 0; }
.score-board { display: flex; gap: clamp(0.8rem, 2.5vw, 2rem); font-weight: bold; font-size: clamp(1rem, 2vw, 1.2rem); align-items: center; }
.team-a { color: var(--primary-purple); } .team-b { color: var(--danger); }
.timer { font-size: clamp(2rem, 4vw, 2.5rem); font-weight: 800; color: var(--lilac); min-width: 90px; text-align: center; font-variant-numeric: tabular-nums; transition: transform 0.1s ease, color 0.3s ease; }

.game-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: clamp(1rem, 2.5vw, 2rem);
    flex-grow: 1; min-height: 0; overflow: hidden;
}

/* 2. KURAL: Oyun Alanı artık kendisi kaydırılamaz (overflow: hidden).
   Böylece butonlar her zaman görünür kalmak zorunda! */
.play-area {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    position: relative; height: 100%; text-align: center;
    overflow: hidden; /* SIKI KONTROL */
    width: 100%;
}

.status-badge {
    margin-bottom: clamp(0.8rem, 2vw, 1.5rem); font-size: clamp(0.95rem, 2vw, 1.1rem);
    color: var(--text-main); padding: 10px 20px; background: var(--header-bg);
    border-radius: 10px; border: 1px solid var(--primary-purple);
    font-weight: 600; text-align: center;
    flex-shrink: 0; /* Başlık asla küçülmez */
    width: 100%; max-width: 450px; /* Kartla aynı hizada durması için */
}

/* 3. KURAL: Kelime Kartı esnek yapıya büründü. Kalan tüm boşluğa yayılır. */
.taboo-card {
    background: linear-gradient(145deg, var(--modal-bg), var(--toast-bg));
    border: 2px solid var(--neon-purple); border-radius: 16px;
    width: 100%; max-width: 450px; text-align: center;
    box-shadow: 0 8px 25px var(--input-bg);

    display: flex;
    flex-direction: column;
    flex: 1; /* Boşluğu kaplar */
    min-height: 0; /* Küçülmesine ve sığmasına tam izin verir */
    margin-bottom: clamp(0.6rem, 1.5vw, 1rem);
}

.card-header { background: var(--header-bg); padding: clamp(1rem, 2.5vw, 1.4rem); border-bottom: 2px solid var(--primary-purple); border-radius: 14px 14px 0 0; flex-shrink: 0; }
.card-header h2 { font-size: clamp(1.4rem, 3.5vw, 1.8rem); color: var(--text-main); margin: 0; letter-spacing: 1px; }

/* 4. KURAL: Eğer kart çok uzarsa SADECE KELİMELER kendi içinde kaydırılır. */
#forbidden-words {
    list-style: none; padding: clamp(1rem, 2.5vw, 1.4rem);
    overflow-y: auto; /* Magic Touch: Kelimeler çoksa burası scrolldur */
    flex: 1;
    min-height: 0;
}
#forbidden-words li { font-size: clamp(1rem, 2.5vw, 1.2rem); margin-bottom: 8px; color: var(--lilac); font-weight: 600; letter-spacing: 0.5px; }
#forbidden-words li:last-child { margin-bottom: 0; }

/* 5. KURAL: Aksiyon Butonları (Doğru/Tabu/Pas) ekrana ÇİVİLENDİ */
.narrator-actions {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.6rem, 1.5vw, 0.8rem);
    width: 100%;
    max-width: 450px;
    justify-content: center;
    flex-shrink: 0; /* BUTONLAR ASLA YOK OLMAZ VEYA TAŞMAZ */
    padding-bottom: 5px;
}

.narrator-actions .btn {
    flex: 1 1 110px;
    padding: clamp(10px, 1.5vw, 14px) 10px !important;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.chat-panel { display: flex; flex-direction: column; height: 100%; padding: clamp(0.8rem, 2vw, 1.2rem); background: var(--card-bg); min-height: 0; }
.messages-container { flex-grow: 1; overflow-y: auto; margin-bottom: 1rem; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; padding-right: 5px; }
.chat-msg { background: var(--input-bg); padding: 8px 12px; border-radius: 8px; border-bottom-left-radius: 0; align-self: flex-start; max-width: 90%; word-break: break-word; line-height: 1.35; }
.chat-msg.self { background: var(--header-bg); border-bottom-left-radius: 8px; border-bottom-right-radius: 0; align-self: flex-end; }
.chat-input-wrapper { display: flex; gap: 8px; flex-shrink: 0; }
.chat-input-wrapper input { flex-grow: 1; min-height: 36px; padding: 10px 14px; font-size: 15px; }


.guesser-mode { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.opponent-mode { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.toggle-btn { background: transparent; border: none; font-size: 1.2rem; cursor: pointer; opacity: 0.8; transition: opacity 0.2s; color: var(--text-muted); }
.toggle-btn:hover { opacity: 1; color: var(--neon-purple); }


@media (max-width: 900px) {
    body { padding-bottom: env(safe-area-inset-bottom); }
    .glass-panel { height: auto; min-height: 0; flex-grow: 1; max-height: none; border-radius: clamp(12px, 2vw, 20px); margin-bottom: clamp(0.5rem, 2vw, 1rem); }

    /* Mobilde yapısal olarak normal akışa izin verdik */
    .game-layout { grid-template-columns: 1fr; overflow-y: visible; display: flex; flex-direction: column; }
    .chat-panel { min-height: 250px; flex-shrink: 0; margin-top: 1rem; }
    .play-area { overflow: visible; flex-grow: 1; min-height: auto; }
    .settings-grid { grid-template-columns: 1fr !important; gap: 0.8rem !important; }
}

@media (max-width: 480px) {
    h1 { font-size: 2.2rem; }
    .btn { font-size: 0.9rem; padding: 10px 16px; }
    #word-card h2 { font-size: 2rem; word-wrap: break-word; }
    .narrator-actions { flex-direction: column; gap: 8px; }
    .narrator-actions .btn { width: 100%; flex: none; }
    .lobby-header { flex-direction: column; align-items: stretch; }
}

