 * { 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;
}

.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; }

.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; }
.cat-checkbox {
    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;
}
.cat-checkbox input[type="checkbox"] { display: none; }
.cat-checkbox: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; }
.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: flex;
    flex-direction: column;
    gap: clamp(1rem, 2.5vw, 2rem);
    flex-grow: 1; min-height: 0; overflow: hidden;
}

.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); }

/* Spinner */
.spinner { width: 40px; height: 40px; margin: 0 auto; display: flex; align-items: center; justify-content: center; }
@keyframes spin { 100% { transform: rotate(360deg); } }

@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); }
    .game-layout { overflow-y: visible; display: flex; flex-direction: column; }
    .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; }
    .lobby-header { flex-direction: column; align-items: stretch; }
}
