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

.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: var(--card-bg); border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: var(--neon-purple); border-radius: 4px; }

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

/* ANA PANEL */
.glass-panel {
    width: 100%;
    max-width: 1200px;
    flex-grow: 1;
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: clamp(12px, 2vw, 20px) clamp(12px, 2vw, 20px) 0 0;
    box-shadow: var(--glass-shadow);
    padding: clamp(1rem, 2.5vw, 2rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-top: 0;
    margin-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; }

.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; }
}
.rule-card { background: var(--card-bg); border: 1px solid var(--lilac-muted); border-radius: 12px; padding: 1.2rem; transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease; }
.rule-card:hover { transform: translateY(-5px); border-color: var(--neon-purple); background: rgba(var(--primary-rgb), 0.1); box-shadow: 0 10px 25px rgba(var(--primary-rgb), 0.15); }
.rule-card h3 { font-size: 1.1rem; color: var(--neon-purple); margin-bottom: 0.5rem; }
.rule-card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; margin: 0; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

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

.form-group { margin-bottom: clamp(1rem, 2.5vw, 1.5rem); width: 100%; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--lilac); font-weight: 600; font-size: 0.9rem; }

input[type="text"], input[type="number"], select {
    width: 100%; padding: 12px 16px; min-height: 40px; background: var(--footer-bg);
    border: 1px solid var(--lilac-muted); border-radius: 10px;
    color: var(--text-main); font-family: inherit; font-size: 16px;
    outline: none; transition: all 0.3s ease;
}

input:focus, select:focus { border-color: var(--neon-purple); background: var(--input-bg); box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.2); }

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

/* Buttons are globally defined in shared.css, but we can override or remove duplicates if any */
.btn {
    padding: 12px 20px; min-height: 40px; border: none; border-radius: 10px;
    font-size: clamp(0.9rem, 2vw, 1rem); font-weight: 600; cursor: pointer; transition: all 0.2s ease;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    color: var(--text-main); touch-action: manipulation; white-space: nowrap;
}
.btn-block { width: 100%; }
.btn-icon { padding: 8px !important; display: inline-flex; align-items: center; justify-content: center; min-height: 0; }

.card {
    background: var(--footer-bg); border: var(--glass-border);
    border-radius: clamp(12px, 2vw, 16px); padding: clamp(1rem, 2.5vw, 1.5rem);
    overflow: hidden; display: flex; flex-direction: column; min-height: 0;
}

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

/* Toast notifications are handled via shared.js */

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

.pop-animation { animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes popIn { 0% { transform: scale(0.95); opacity: 0.5; } 100% { transform: scale(1); opacity: 1; } }

/* 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; }
    .btn { font-size: 0.9rem; padding: 10px 16px; }
    .lobby-header { flex-direction: column; align-items: stretch; }
}
