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

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: 1000px; /* Biraz daha dar tuttuk */
    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; text-align: center; width: 100%; }

/* SEO ve Kurallar Bölümü */
.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, 4rem);
    font-weight: 800; text-align: center; margin-bottom: 0.5rem;
}
.subtitle { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 2rem; font-weight: 300; letter-spacing: 1px; }

.form-group { margin-bottom: clamp(1rem, 2.5vw, 1.5rem); width: 100%; text-align: left;}
.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(59, 130, 246, 0.2); }

.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-primary { background: var(--primary-purple); }
.btn-primary:hover:not(.disabled) { background: var(--neon-purple); transform: translateY(-2px); box-shadow: 0 6px 15px rgba(59, 130, 246, 0.3); }
.btn-secondary { background: var(--input-bg); border: 1px solid var(--lilac-muted); }
.btn-secondary:hover { background: var(--btn-secondary-bg); border-color: var(--lilac); transform: translateY(-2px); }
.btn-success { background: rgba(16, 185, 129, 0.2); color: var(--success); border: 1px solid var(--success); }
.btn-success:hover { background: rgba(16, 185, 129, 0.3); transform: translateY(-2px); }
.btn-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.3); transform: translateY(-2px); }
.btn-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); border: 1px solid var(--warning); }
.btn-warning:hover { background: rgba(245, 158, 11, 0.3); transform: translateY(-2px); }
.btn-block { width: 100%; }

.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(--neon-purple); 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; }
.round-indicator { font-weight: 600; font-size: 1.1rem; color: var(--lilac); background: var(--code-bg); padding: 5px 15px; border-radius: 10px; }
.timer { font-size: clamp(2rem, 4vw, 3rem); 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; }

.cizbil-layout {
    display: flex; flex-direction: column; gap: 1rem; height: 100%;
}
@media (min-width: 900px) {
    .cizbil-layout { flex-direction: row; align-items: stretch; }
    .game-area { flex: 2; display: flex; flex-direction: column; }
    .sidebar { flex: 1; max-width: 350px; display: flex; flex-direction: column; }
}

.canvas-container { border-radius: 1rem; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.5); border: 4px solid var(--border-color); width: 100%; background: #fff; touch-action: none; position: relative; cursor: crosshair; }

.toolbar { display: flex; gap: 1rem; margin-top: 1rem; padding: 1rem; background: var(--card-bg); border-radius: 1rem; border: 1px solid var(--border-color); width: 100%; max-width: 800px; justify-content: center; align-items: center; flex-wrap: wrap; margin-left: auto; margin-right: auto; }
.color-picker { display: flex; gap: 0.5rem; }
.color-swatch { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform 0.2s; }
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: #fff; box-shadow: 0 0 10px rgba(255,255,255,0.8); }

.size-picker { display: flex; gap: 0.5rem; align-items: center; }
.size-btn { width: 30px; height: 30px; border-radius: 50%; background: var(--btn-secondary-bg); display: flex; justify-content: center; align-items: center; cursor: pointer; border: 1px solid var(--btn-secondary-border); }
.size-btn.active { background: var(--btn-secondary-hover); border-color: var(--neon-purple); }
.size-dot { background: var(--text-main); border-radius: 50%; }

.tools { display: flex; gap: 0.5rem; }
.canvas-container canvas { display: block; width: 100%; aspect-ratio: 16/9; }

[data-theme="light"] .canvas-container { box-shadow: 0 5px 20px rgba(0,0,0,0.1); border-color: var(--lilac-muted); }

.chat-msg {
    padding: 0.5rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    word-break: break-word;
    background: var(--msg-bg);
}
.chat-msg.correct {
    background: var(--success-bg);
    border: 1px solid var(--success);
}

.toggle-btn { background: transparent; border: none; font-size: 1.2rem; cursor: pointer; opacity: 0.8; transition: opacity 0.2s; }
.toggle-btn:hover { opacity: 1; }

@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); }
    .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; }
    #current-letters { font-size: 2rem !important; word-wrap: break-word; }
    .lobby-header { flex-direction: column; align-items: stretch; }
    #ebe-area input { font-size: 0.95rem; }
    #masum-area input { font-size: 0.95rem; }
}
