/* =========================================================================
   VoiceLink v3 - Stil
   Mobil uygulama hedefi icin: safe-area destegi, dokunma hedefleri,
   responsive iki panelli duzen.
   ========================================================================= */

/* Ulke bayraklari: Windows'ta bayrak emojisi glifi yok (TR yerine "TR" harfleri cikar).
   Twemoji Country Flags (country-flag-emoji-polyfill, MIT; cizimler Twemoji CC-BY 4.0)
   yalnizca bolgesel gosterge harflerini (U+1F1E6-1F1FF) kapsar - diger karakterlere dokunmaz. */
@font-face {
    font-family: 'Twemoji Country Flags';
    src: url('fonts/TwemojiCountryFlags.woff2') format('woff2');
    unicode-range: U+1F1E6-1F1FF;
    font-display: swap;
}

/* Tema: <html data-theme="dark|light"> (theme-boot.js ve app.js applyTheme ayarlar) */
:root, [data-theme="dark"] {
    --bg-darker: #000000;   /* sohbet alani, giris kutulari */
    --bg-dark:   #0e0e10;   /* kenar cubugu, basliklar, pencereler */
    --bg-panel:  #1b1b1f;   /* kartlar, secili oge, ikincil dugmeler */
    --bg-hover:  #27272d;
    --bg-rail:   #050506;   /* en soldaki sunucu rayi */
    --text-main: #f2f2f3;
    --text-muted:#9b9ba5;
    --border:    rgba(var(--ov), 0.09);
    --ov:        255,255,255;   /* hover gibi yari saydam katmanlarin rengi */
    --shadow:    0 14px 40px rgba(0,0,0,0.65);
    --auth-glow: #1c1c26;
    --ok-text:   #86efac;
    --warn-text: #fcd34d;
    --danger-text: #fca5a5;
    --mention-me: #eab308;
    color-scheme: dark;
}
[data-theme="light"] {
    --bg-darker: #faf8f3;   /* kirik beyaz */
    --bg-dark:   #f1eee7;
    --bg-panel:  #e6e2d9;
    --bg-hover:  #dad5c9;
    --bg-rail:   #e8e4db;
    --text-main: #1e1c19;
    --text-muted:#6b665d;
    --border:    rgba(0,0,0,0.1);
    --ov:        0,0,0;
    --shadow:    0 14px 40px rgba(70,55,30,0.18);
    --auth-glow: #ffffff;
    --ok-text:   #15803d;
    --warn-text: #b45309;
    --danger-text: #dc2626;
    --mention-me: #a16207;
    color-scheme: light;
}
:root {
    --primary:   #6366f1;
    --primary-hover: #4f46e5;
    --accent:    #a855f7;
    --danger:    #ef4444;
    --warn:      #f59e0b;
    --success:   #22c55e;
    --text:      var(--text-main);
    --muted:     var(--text-muted);
    --radius:    10px;

    /* Hareket dili (A "Sakin"): giris yavaslayarak durur, cikis hizlanarak kaybolur */
    --d-fast:    120ms;   /* hover, basma, renk */
    --d-base:    200ms;   /* menu, acilir kutu, ikon degisimi */
    --d-slow:    320ms;   /* modal, toast, panel kaymasi */
    --e-out:     cubic-bezier(.2,0,0,1);
    --e-in:      cubic-bezier(.3,0,1,1);

    --safe-top:    env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left:   env(safe-area-inset-left, 0px);
    --safe-right:  env(safe-area-inset-right, 0px);
}

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

html, body {
    height: 100%;
    overscroll-behavior: none;
}
html { font-size: 16px; }
html[data-font-size="small"] { font-size: 14.5px; }
html[data-font-size="large"] { font-size: 17.5px; }

body {
    background-color: var(--bg-darker);
    color: var(--text-main);
    font-family: 'Twemoji Country Flags', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
}

.hidden { display: none !important; }
.muted  { color: var(--text-muted); font-size: 0.85rem; }

.screen { width: 100%; height: 100dvh; display: flex; }

/* ---------- Yukleniyor ---------- */
.loading-screen {
    position: fixed; inset: 0; z-index: 3000;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-darker);
}
.spinner {
    width: 42px; height: 42px; border-radius: 50%;
    border: 3px solid var(--bg-panel); border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Giris ekrani ---------- */
#auth-screen {
    justify-content: center; align-items: center;
    background: radial-gradient(circle at 30% 10%, var(--auth-glow), var(--bg-darker) 60%);
    padding: calc(1rem + var(--safe-top)) 1rem calc(1rem + var(--safe-bottom));
    overflow-y: auto;
}

.auth-card {
    background: var(--bg-dark);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.5);
    width: 100%; max-width: 420px;
    border: 1px solid var(--border);
}

.brand { text-align: center; margin-bottom: 1.75rem; }
.brand-mark { font-size: 2.4rem; line-height: 1; }
.brand-mark img { width: 56px; height: 56px; display: block; margin: 0 auto; }
.logo { color: var(--text-main); font-size: 1.7rem; margin-top: 0.4rem; letter-spacing: -0.02em; }
.tagline { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }

.auth-invite-note {
    display: flex; align-items: center; gap: 0.75rem; margin: -0.5rem 0 1.25rem;
    padding: 0.7rem 0.8rem; border-radius: 12px; border: 1px solid var(--border);
    background: color-mix(in srgb, var(--primary) 9%, var(--bg-darker));
}
.auth-invite-note > div { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.auth-invite-note b { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-invite-note small { color: var(--text-muted); font-size: 0.78rem; }
.auth-invite-note.error { background: color-mix(in srgb, var(--danger) 10%, var(--bg-darker)); }
.auth-invite-note.error > .i { color: var(--danger); width: 22px; height: 22px; flex: none; }

.auth-tabs { display: flex; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }

.tab-btn {
    flex: 1; background: none; border: none; color: var(--text-muted);
    padding: 0.75rem; cursor: pointer; font-size: 0.95rem; font-weight: 500;
    border-bottom: 2px solid transparent; transition: color var(--d-fast) var(--e-out), border-color var(--d-fast) var(--e-out); font-family: inherit;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.auth-form { display: none; flex-direction: column; gap: 1rem; }
.auth-form.active { display: flex; }

/* ---------- Form ogeleri ---------- */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }
.form-group small { font-size: 0.72rem; color: var(--text-muted); }

.device-row { display: flex; gap: 0.5rem; align-items: center; }
.device-row select { flex: 1; min-width: 0; }
.form-row { display: flex; gap: 0.75rem; }
.form-row .form-group { flex: 1; min-width: 0; }

input, textarea, select {
    background: var(--bg-darker);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.7rem 0.8rem;
    border-radius: 8px;
    font-size: 16px; /* iOS'ta otomatik zoom olmasin */
    outline: none;
    font-family: inherit;
    width: 100%;
    transition: border-color var(--d-fast) var(--e-out);
}
input:focus, textarea:focus { border-color: var(--primary); }
input:disabled { opacity: 0.5; cursor: not-allowed; }
textarea { resize: vertical; min-height: 70px; }

.btn {
    padding: 0.75rem 1.25rem;
    border: none; border-radius: 8px;
    font-size: 0.95rem; font-weight: 600;
    cursor: pointer;
    transition: background var(--d-fast) var(--e-out), opacity var(--d-fast) var(--e-out), transform var(--d-fast) var(--e-out);
    font-family: inherit; color: var(--text-main);
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: var(--bg-panel); }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.danger-outline { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn.danger-outline:hover { background: rgba(239,68,68,0.12); }
.btn.small { padding: 0.45rem 0.75rem; font-size: 0.8rem; }
.w-100 { width: 100%; }

.error-message   { color: var(--danger);  font-size: 0.82rem; text-align: center; min-height: 1.1rem; }
.success-message { color: var(--success); font-size: 0.82rem; text-align: center; min-height: 1.1rem; }

/* ---------- Ana duzen ---------- */
#main-view { display: flex; }

.sidebar {
    width: 300px; flex-shrink: 0;
    background: var(--bg-dark);
    display: flex; flex-direction: column;
    border-right: 1px solid var(--border);
    padding-top: var(--safe-top);
    padding-left: var(--safe-left);
}

.sidebar-header {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.sidebar-header h2 { font-size: 1.1rem; }
.header-actions { display: flex; gap: 0.25rem; }

.connection-status {
    padding: 0.35rem 1.1rem;
    font-size: 0.72rem;
    border-bottom: 1px solid var(--border);
}
.connection-status.online     { color: var(--success); }
.connection-status.connecting { color: var(--warn); }
.connection-status.offline    { color: var(--danger); }

.icon-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 0.5rem; border-radius: 8px;
    font-size: 1rem; line-height: 1;
    transition: background var(--d-fast) var(--e-out), color var(--d-fast) var(--e-out), transform var(--d-fast) var(--e-out);
    min-width: 38px; min-height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--text-main); background: rgba(var(--ov), 0.08); }
.icon-btn.danger:hover { color: var(--danger); background: rgba(239,68,68,0.12); }
.icon-btn.active { color: var(--danger); background: rgba(239,68,68,0.14); }
.i { width: 1.25em; height: 1.25em; stroke-width: 1.75; flex: none; vertical-align: -0.25em; }

/* ---------- Oda listesi ---------- */
.rooms-list { flex: 1; overflow-y: auto; padding: 0.5rem; -webkit-overflow-scrolling: touch; }

.empty-hint {
    color: var(--text-muted); font-size: 0.85rem;
    text-align: center; padding: 2rem 1rem; line-height: 1.6;
}

.room-item {
    padding: 0.7rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    margin-bottom: 0.3rem;
    transition: background var(--d-fast) var(--e-out);
    border-left: 3px solid transparent;
}
.room-item:hover { background: var(--bg-panel); }
.room-item.active { background: var(--bg-panel); border-left-color: var(--primary); }

.room-header { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.room-name { font-weight: 500; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-header-right { display: flex; gap: 0.35rem; align-items: center; flex-shrink: 0; }
.room-stats { font-size: 0.72rem; color: var(--text-muted); }
.room-voice-badge { font-size: 0.75rem; color: var(--primary); }
.room-topic { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }

.room-users { display: flex; flex-direction: column; gap: 0.15rem; margin-top: 0.5rem; }

.room-user {
    font-size: 0.82rem; color: var(--text-muted);
    display: flex; align-items: center; gap: 0.45rem;
    padding: 0.25rem 0.35rem; border-radius: 6px;
    cursor: pointer; transition: background var(--d-fast) var(--e-out);
}
.room-user:hover { background: rgba(var(--ov), 0.06); color: var(--text-main); }
.room-user .user-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-user .user-name em { font-style: normal; opacity: 0.55; font-size: 0.75rem; }
.room-user.is-muted .user-name { opacity: 0.55; }
.room-user.is-speaking { color: var(--success); }
.room-user.is-speaking .avatar { box-shadow: 0 0 0 2px var(--success); }
.ru-state { display: inline-flex; flex: none; }
.vs-icon { display: inline-flex; color: var(--text-muted); }
.vs-icon .i { width: 15px; height: 15px; }
.vs-icon.forced { color: var(--danger); }


.admin-controls { display: flex; gap: 0.15rem; opacity: 0; transition: opacity var(--d-fast) var(--e-out); }
.room-user:hover .admin-controls { opacity: 1; }
.admin-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 0.72rem; padding: 0.2rem;
    border-radius: 4px; line-height: 1;
}
.admin-btn:hover { background: rgba(var(--ov), 0.12); }

/* ---------- Avatar ---------- */
.avatar {
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; color: #fff; flex-shrink: 0;
    overflow: hidden; background: var(--primary);
    user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-slot { display: inline-flex; flex-shrink: 0; }
.avatar-slot.large { align-self: flex-start; }

/* ---------- Kullanici paneli ---------- */
.user-panel {
    background: var(--bg-darker);
    padding: 0.6rem 0.7rem calc(0.6rem + var(--safe-bottom));
    display: flex; justify-content: space-between; align-items: center;
    gap: 0.5rem; border-top: 1px solid var(--border);
}

.user-info {
    display: flex; align-items: center; gap: 0.6rem;
    background: none; border: none; cursor: pointer;
    padding: 0.25rem; border-radius: 8px; flex: 1;
    /* Fotograf + en az birkac harf her zaman sigsin - dugmeler fotografin ustune binmesin */
    min-width: 84px; overflow: hidden;
    color: inherit; font-family: inherit; text-align: left;
}
.user-info:hover { background: rgba(var(--ov), 0.06); }

.user-details { min-width: 0; flex: 1; }
.user-details .name   { font-size: 0.86rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-details .status { font-size: 0.72rem; color: var(--success); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-controls { display: flex; gap: 0.1rem; flex-shrink: 0; }
.user-controls .icon-btn, .voice-bar-controls .icon-btn { min-width: 34px; min-height: 34px; padding: 0.4rem; }

/* ---------- Ses baglantisi cubugu ---------- */
.voice-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
    padding: 0.5rem 0.7rem; background: var(--bg-darker);
    border-top: 1px solid var(--border);
}
.voice-bar-info { min-width: 0; flex: 1; }
.voice-bar-status {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.78rem; font-weight: 600; color: var(--success);
}
.voice-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(34,197,94,0.18);
}
/* Kopma / yeniden baglanma: ayni cubukta sari, nokta yanip soner */
.voice-bar-status.connecting { color: var(--warn); }
.voice-bar-status.offline    { color: var(--danger); }
.voice-bar-status:is(.connecting, .offline) .voice-dot {
    background: currentColor; box-shadow: none; animation: rec-pulse 1s ease-in-out infinite;
}
.voice-bar-status:is(.connecting, .offline) .voice-ping { display: none; }
.voice-bar-room {
    font-size: 0.72rem; color: var(--text-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.voice-bar-controls { display: flex; gap: 0.1rem; flex-shrink: 0; }
.voice-bar + .user-panel { border-top-color: transparent; }

/* ---------- Sohbet ---------- */
.chat-area {
    flex: 1; display: flex; flex-direction: column;
    background: var(--bg-darker); min-width: 0;
    padding-top: var(--safe-top); padding-right: var(--safe-right);
}

.chat-header {
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-dark);
    display: flex; align-items: center; gap: 0.6rem;
}
.chat-header h3 { font-size: 1rem; }
.chat-header-text { min-width: 0; }
.room-topic-header { font-size: 0.75rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-only { display: none; }

.messages {
    flex: 1; overflow-y: auto; padding: 1.2rem;
    display: flex; flex-direction: column; gap: 0.9rem;
    -webkit-overflow-scrolling: touch;
}

.chat-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* ---------- Gorusme sahnesi ----------
   Acikken sahne ana alani alir, sohbet sagda dar sutuna gecer (mobilde alta) */
.chat-area:has(> .call-stage:not(.hidden)) { flex-direction: row; }
.chat-area:has(> .call-stage:not(.hidden)) > .chat-pane {
    flex: 0 0 320px; border-left: 1px solid var(--border); overflow: hidden;
    transition: flex-basis var(--d-slow) var(--e-out);
}
/* Kapanirken icerik ezilmesin: sutun daralir, icerik 320px kalip kirpilir */
.chat-area:has(> .call-stage:not(.hidden)) > .chat-pane > * { min-width: 320px; }
.chat-area.chat-closed:has(> .call-stage:not(.hidden)) > .chat-pane {
    flex-basis: 0; border-left-width: 0;
    transition-duration: var(--d-base); transition-timing-function: var(--e-in);
}
.call-chat-btn { margin-left: auto; position: relative; }
.call-chat-btn.active { color: var(--primary); }
.call-chat-btn .unread-dot {
    position: absolute; top: 4px; right: 4px; width: 8px; height: 8px;
    border-radius: 50%; background: var(--danger);
}
.call-stage {
    flex: 1; min-width: 0; min-height: 0;
    display: flex; flex-direction: column;
    background: var(--bg-dark);
}
.call-stage-head {
    display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0;
    padding: 0.9rem 1.2rem 0.3rem; font-weight: 600; font-size: 0.95rem;
}
.call-stage-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-stage-count { color: var(--text-muted); font-weight: 400; font-size: 0.8rem; white-space: nowrap; }

/* ---------- Video izgarasi (goruntulu konusma) ---------- */
/* Kutu genisligi (--tw) fitStage() hesaplar: en buyuk 16/9 kutuyu veren sutun sayisi, son satir ortada.
   Ekran paylasimi varsa o ana kutu (tam genislik, --main-h), digerleri altta serit */
.video-grid {
    flex: 1; min-height: 0; overflow: hidden;
    display: flex; flex-wrap: wrap; justify-content: center; align-content: center;
    gap: 8px; padding: 0.8rem 1.2rem 1.2rem;
}
.video-grid > * { width: var(--tw, 200px); flex: none; transition: width var(--d-base) var(--e-out); }
/* order: kamerasi once acik olsa da (DOM'da once) ekran paylasimi ustte, kameralar altta seritte */
.video-grid > .stage-main { width: 100%; height: var(--main-h); aspect-ratio: auto; order: -1; }
.video-tile {
    position: relative; aspect-ratio: 16/9; border-radius: var(--radius);
    overflow: hidden; background: #000;
}
.video-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Kamerasi kapali seste olan: avatar kutusu */
.voice-tile {
    position: relative; aspect-ratio: 16/9; border-radius: var(--radius);
    background: var(--bg-panel); display: flex; align-items: center; justify-content: center;
}
/* Konusma: kamerali kutuda kenar, sesli kutuda avatar halkasi */
.video-tile { outline: 2px solid transparent; outline-offset: -2px; transition: outline-color var(--d-fast) var(--e-out), width var(--d-base) var(--e-out); }
.voice-tile .avatar { transition: box-shadow var(--d-fast) var(--e-out); }
.video-tile.speak { outline-color: var(--success); }
.voice-tile.speak .avatar { box-shadow: 0 0 0 3px var(--bg-panel), 0 0 0 5px var(--success); }
.tile-mic { display: none; margin-left: 0.3rem; color: var(--danger); }
.tile-mic .vs-icon, .tile-mic .vs-icon.forced { color: inherit; }
.muted > .video-tile-name .tile-mic { display: inline-flex; vertical-align: -2px; }
.video-tile-name {
    position: absolute; left: 0.5rem; bottom: 0.4rem;
    background: rgba(0,0,0,0.55); color: #fff; font-size: 0.75rem;
    padding: 0.15rem 0.5rem; border-radius: 6px;
}
#btn-camera.active,
#btn-screen-share.active { color: var(--primary); background: rgba(99,102,241,0.16); }
#btn-mute.locked, #btn-deafen.locked {
    background: rgba(239,68,68,0.18); color: #ef4444; position: relative;
}
#btn-mute.locked::after, #btn-deafen.locked::after {
    /* Tabler lock; renk dugmeyle ayni olsun diye maske */
    content: ''; position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0M8 11v-4a4 4 0 1 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0M8 11v-4a4 4 0 1 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* Mikrofon hic acilamadi (izin yok / cihaz yok) - tiklayinca tekrar izin istenir */
#btn-mute.no-mic { position: relative; color: var(--warning, #f59e0b); background: rgba(245,158,11,0.14); }
#btn-mute.no-mic::after {
    content: '!'; position: absolute; right: 1px; top: 1px;
    width: 13px; height: 13px; border-radius: 50%; background: #f59e0b; color: #111;
    font-size: 0.6rem; font-weight: 800; display: flex; align-items: center; justify-content: center;
}

/* Ekran paylasimi kutucugu: icerik cogu zaman 16/9 degildir, kirpmak yerine sigdir */
.video-tile-screen video { object-fit: contain; background: #000; }

/* Tiklama kutuyu buyutur (ana kutu); tam ekran kosedeki dugmeyle */
.video-tile { cursor: pointer; }
.video-grid > .stage-main video { object-fit: contain; background: #000; }
.tile-fs {
    position: absolute; right: 0.4rem; top: 0.4rem; z-index: 1;
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border: none; border-radius: 6px; cursor: pointer;
    background: rgba(0,0,0,0.55); color: #fff;
    opacity: 0; transition: opacity var(--d-fast) var(--e-out), background var(--d-fast) var(--e-out);
}
.video-tile:hover > .tile-fs, .tile-fs:focus-visible { opacity: 1; }
.tile-fs:hover { background: rgba(0,0,0,0.8); }
@media (hover: none) { .tile-fs { opacity: 1; } }   /* dokunmatikte hover yok */

.video-fullscreen {
    position: fixed; inset: 0; z-index: 2000;
    background: #000; display: flex; flex-direction: column;
}
.video-fullscreen.hidden { display: none; }
.fs-toolbar {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 1rem; background: rgba(14,14,16,0.85); flex-shrink: 0;   /* koyu --bg-dark; video hep koyu zeminde */
}
.fs-mode-btn {
    background: rgba(255,255,255,0.08); color: #fff; border: none; border-radius: 8px;
    padding: 0.4rem 0.9rem; cursor: pointer; font-size: 0.85rem;
}
.fs-mode-btn.active { background: var(--primary); }
.fs-close-btn { margin-left: auto; background: none; border: none; color: #fff; font-size: 1.15rem; cursor: pointer; padding: 0.3rem 0.6rem; line-height: 1; }
.fs-stage { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.fs-main { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; background: #000; }
.fs-main video { width: 100%; height: 100%; object-fit: contain; }
.fs-main .video-tile-name { position: absolute; left: 1rem; bottom: 1rem; font-size: 0.9rem; }
.fs-thumbs {
    display: flex; gap: 0.5rem; padding: 0.6rem 1rem; overflow-x: auto;
    background: rgba(14,14,16,0.6); flex-shrink: 0;
}
.fs-thumb {
    position: relative; width: 140px; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden;
    background: #111; cursor: pointer; flex-shrink: 0; border: 2px solid transparent;
}
.fs-thumb.active { border-color: var(--primary); }
.fs-thumb video { width: 100%; height: 100%; object-fit: cover; }
.fs-thumb .video-tile-name { font-size: 0.65rem; padding: 0.1rem 0.35rem; }
.fs-grid {
    flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.6rem; padding: 1rem; overflow-y: auto;
}
.fs-grid .video-tile { aspect-ratio: 16/9; cursor: default; }
.fs-grid .video-tile video { object-fit: contain; }

.message { display: flex; gap: 0.65rem; align-items: flex-start; position: relative; padding: 0.15rem 2.2rem 0.15rem 0; border-radius: 8px; }
.message:hover { background: rgba(var(--ov), 0.03); }
.msg-body { min-width: 0; flex: 1; }
.msg-header { display: flex; align-items: baseline; gap: 0.5rem; }
.msg-author { font-weight: 600; color: var(--accent); font-size: 0.88rem; cursor: pointer; }
.msg-author:hover { text-decoration: underline; }
.message.own .msg-author { color: var(--primary); }
.msg-time { font-size: 0.7rem; color: var(--text-muted); }
.msg-content { font-size: 0.92rem; line-height: 1.45; word-break: break-word; white-space: pre-wrap; }
.msg-content a { color: var(--primary); }
.msg-content .mention { background: rgba(99,102,241,0.18); color: var(--primary); border-radius: 4px; padding: 0 0.25rem; font-weight: 600; }
.msg-content .mention.me { background: rgba(234,179,8,0.25); color: var(--mention-me); }

.msg-actions {
    position: absolute; right: 0.2rem; top: -0.3rem;
    display: none; gap: 0.15rem; background: var(--bg-dark); border: 1px solid var(--border);
    border-radius: 8px; padding: 0.15rem; box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.message:hover .msg-actions { display: flex; }
.msg-action-btn {
    background: none; border: none; cursor: pointer; border-radius: 6px;
    padding: 0.3rem 0.4rem; font-size: 0.9rem; color: var(--text-muted); line-height: 1;
}
.msg-action-btn:hover { background: rgba(var(--ov), 0.08); color: var(--text); }

.msg-reply-ref {
    display: flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; color: var(--text-muted);
    margin-bottom: 0.15rem; cursor: pointer; max-width: 100%; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.msg-reply-ref:hover { color: var(--text); }
.msg-reply-ref b { color: var(--accent); font-weight: 600; }
.msg-reply-ref .reply-icon { flex-shrink: 0; }
.message.highlight-flash { animation: msgFlash 1.6s var(--e-out); }
@keyframes msgFlash { 0%, 40% { background: rgba(99,102,241,0.22); } 100% { background: transparent; } }

.msg-reactions { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }

/* Mesaj islemleri */
.message.deleted { opacity: .55; padding-left: 42px; font-size: .8rem; color: var(--text-muted); font-style: italic; }
.message.deleted:hover { background: none; }
/* Gonderilmekte olan / gonderilemeyen kendi mesaji (bkz. app.js addPendingMessage) */
.message.pending .msg-body { opacity: .55; }
.message.failed .msg-content { color: var(--danger); }
.msg-failed { display: inline-flex; align-items: center; gap: .25rem; margin-left: .4rem; font-size: .72rem; color: var(--danger); }
.msg-failed .i { width: 13px; height: 13px; }
.message.pinned { box-shadow: inset 3px 0 0 var(--warn); padding-left: 6px; }
.msg-forwarded { border-left: 3px solid var(--border); padding-left: .55rem; margin-top: .15rem; }
.msg-forwarded-label { font-size: .74rem; color: var(--text-muted); margin-bottom: .15rem; }
.msg-edit-box textarea {
    width: 100%; min-height: 54px; background: var(--bg-panel); color: var(--text-main);
    border: 1px solid var(--primary); border-radius: 8px; padding: .5rem .6rem;
    font: inherit; font-size: .92rem; resize: vertical;
}
.msg-edit-hint { font-size: .72rem; color: var(--text-muted); margin-top: .2rem; }
.msg-edit-hint a { color: var(--primary); cursor: pointer; }
.msg-modal-hint { color: var(--text-muted); font-size: .88rem; margin-bottom: .6rem; }
.msg-modal-preview { background: var(--bg-darker); border-radius: 8px; padding: .5rem .6rem; font-size: .82rem; color: var(--text-muted); word-break: break-word; }
.msg-modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .9rem; }
.fwd-search { width: 100%; margin: .6rem 0; }
.fwd-list { max-height: 280px; overflow-y: auto; }
.fwd-group { font-size: .7rem; text-transform: uppercase; color: var(--text-muted); margin: .5rem .2rem .2rem; letter-spacing: .04em; }
.fwd-ch { display: flex; justify-content: space-between; padding: .4rem .5rem; border-radius: 6px; font-size: .86rem; cursor: pointer; }
.fwd-ch:hover, .fwd-ch.sel { background: var(--bg-panel); }

/* Sabitli mesajlar paneli */
.chat-main-row { flex: 1; display: flex; min-height: 0; }
.chat-col { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

/* Gunumuze git */
.jump-now {
    position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 5;
    background: var(--primary); color: #fff; border: none; border-radius: 999px;
    padding: .45rem 1rem; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,.35); white-space: nowrap;
}
.jump-now:hover { background: var(--primary-hover); }
.pins-panel { width: 280px; flex-shrink: 0; background: var(--bg-dark); border-left: 1px solid var(--border); overflow-y: auto; padding: .5rem; }
.pins-title { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: .9rem; padding: .3rem .4rem .5rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.pin-item { padding: .45rem .5rem; border-radius: 8px; cursor: pointer; font-size: .84rem; word-break: break-word; }
.pin-item:hover { background: var(--bg-panel); }
.pin-item small { color: var(--text-muted); display: block; font-size: .72rem; }
.pins-empty { color: var(--text-muted); font-size: .82rem; padding: .6rem .4rem; }
@media (max-width: 768px) {
    .pins-panel { position: fixed; inset: 0; width: auto; z-index: 900; padding-top: calc(var(--safe-top) + .5rem); }
}
.reaction-pill {
    display: flex; align-items: center; gap: 0.25rem; background: rgba(var(--ov), 0.06);
    border: 1px solid var(--border); border-radius: 999px; padding: 0.1rem 0.5rem;
    font-size: 0.78rem; cursor: pointer; color: var(--text);
}
.reaction-pill:hover { background: rgba(var(--ov), 0.1); }
.reaction-pill.mine { background: rgba(99,102,241,0.2); border-color: var(--primary); }

.reply-preview, .attach-preview {
    display: flex; align-items: center; gap: 0.5rem; background: rgba(var(--ov), 0.05);
    border-radius: 8px; padding: 0.45rem 0.7rem; margin-bottom: 0.5rem; font-size: 0.82rem;
}
.reply-preview.hidden { display: none; }
.reply-preview .reply-preview-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.reply-cancel-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0.2rem; }

.emoji-picker {
    position: fixed; z-index: 3000; background: var(--bg-dark); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: 0 14px 40px rgba(0,0,0,0.5);
    width: min(352px, calc(100vw - 16px)); height: min(400px, calc(100vh - 90px));
    display: flex; flex-direction: column; overflow: hidden;
}
.emoji-search {
    margin: 0.6rem 0.6rem 0.4rem; padding: 0.5rem 0.7rem; font-size: 0.85rem;
    border-radius: 8px; flex-shrink: 0;
}
.emoji-tabs {
    display: flex; gap: 0.1rem; padding: 0 0.5rem 0.35rem; flex-shrink: 0;
    border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
}
.emoji-tab {
    background: none; border: none; cursor: pointer; font-size: 1.05rem; line-height: 1;
    padding: 0.35rem; border-radius: 6px; flex: 1; min-width: 30px; opacity: 0.75;
}
.emoji-tab:hover { background: rgba(var(--ov), 0.08); opacity: 1; }
.emoji-scroll { flex: 1; overflow-y: auto; padding: 0.2rem 0.45rem 0.5rem; overscroll-behavior: contain; }
/* 1600+ emoji: gorunmeyen kategoriler kaydirilana kadar yerlestirilip cizilmesin (ilk acilis hizli olsun) */
.emoji-section { content-visibility: auto; contain-intrinsic-size: auto 360px; }
.emoji-section h4, .emoji-results h4 {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted); margin: 0.55rem 0.2rem 0.25rem;
    position: sticky; top: -0.2rem; background: var(--bg-dark); padding: 0.2rem 0; z-index: 1;
}
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 0.05rem; }
.emoji-opt {
    background: none; border: none; font-size: 1.45rem; cursor: pointer; border-radius: 6px;
    padding: 0.25rem 0; line-height: 1.2; font-family: "Twemoji Country Flags", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}
.emoji-opt:hover { background: rgba(var(--ov), 0.1); transform: scale(1.12); }
.emoji-empty, .emoji-loading { color: var(--text-muted); font-size: 0.82rem; padding: 1rem; grid-column: 1 / -1; text-align: center; }

.system-message {
    text-align: center; color: var(--text-muted);
    font-size: 0.78rem; font-style: italic; margin: 0.2rem 0;
}
.system-message.error { color: var(--danger); }

.typing-indicator {
    padding: 0 1.2rem; min-height: 20px;
    font-size: 0.78rem; color: var(--text-muted); font-style: italic;
    display: flex; align-items: center;
    transition: opacity var(--d-base) var(--e-out); opacity: 0;
}
.typing-indicator.active { opacity: 1; }

.chat-input-area {
    padding: 0.9rem 1.2rem calc(0.9rem + var(--safe-bottom));
    background: var(--bg-dark);
}
#chat-form { display: flex; gap: 0.5rem; }
#chat-input {
    flex: 1; background: var(--bg-panel); border: 1px solid transparent;
    padding: 0.85rem 1rem; border-radius: 10px;
}
#chat-input:focus { border-color: var(--primary); }
.send-btn { padding: 0 1.1rem; flex-shrink: 0; }

/* ---------- Modal / Overlay ---------- */
.overlay, .modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(3px);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000; padding: 1rem;
}
.modal { overflow-y: auto; align-items: flex-start; padding-top: max(3vh, var(--safe-top)); }

.overlay-content, .modal-content {
    background: var(--bg-dark);
    padding: 1.75rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    max-width: 460px; width: 100%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    margin-bottom: 3vh;
}
.modal-content.wide { max-width: 560px; }
.overlay-content { text-align: center; }
.overlay-content h2 { margin: 0.75rem 0 0.4rem; }
.overlay-content p { color: var(--text-muted); margin-bottom: 1.4rem; font-size: 0.9rem; }
.big-icon { font-size: 2.8rem; }

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.4rem;
}
.modal-header h2 { font-size: 1.15rem; }
.close-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 1.05rem; padding: 0.4rem;
    border-radius: 6px; line-height: 1;
}
.close-btn:hover { color: var(--text-main); background: rgba(var(--ov), 0.08); }

.modal-body { text-align: left; display: flex; flex-direction: column; gap: 1rem; }
.modal-body form { display: flex; flex-direction: column; gap: 0.9rem; }
.modal-actions { display: flex; flex-direction: column; gap: 0.5rem; }

.divider { border: none; border-top: 1px solid var(--border); margin: 0.25rem 0; }
.section-title { font-size: 0.95rem; color: var(--text-muted); }

/* ---------- Ayarlar ---------- */
.setting-group { display: flex; flex-direction: column; gap: 0.45rem; }
.setting-group > label { font-size: 0.88rem; font-weight: 500; }
.setting-group small { color: var(--text-muted); font-size: 0.74rem; line-height: 1.5; }

.slider-container { display: flex; align-items: center; gap: 0.9rem; }
.slider-val { font-size: 0.78rem; color: var(--text-muted); min-width: 92px; text-align: right; flex-shrink: 0; }

input[type="range"] {
    flex: 1; height: 6px; -webkit-appearance: none; appearance: none;
    background: var(--bg-panel); border-radius: 3px;
    outline: none; border: none; padding: 0; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--primary); cursor: pointer; border: 2px solid var(--bg-dark);
}
input[type="range"]::-moz-range-thumb {
    width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--bg-dark);
    background: var(--primary); cursor: pointer;
}

.meter-container { display: flex; flex-direction: column; gap: 0.4rem; }
.meter-head { display: flex; justify-content: space-between; align-items: center; }
.meter-head label { font-size: 0.88rem; font-weight: 500; }
.gate-status { font-size: 0.72rem; color: var(--text-muted); }
.meter-bar { height: 10px; background: var(--bg-panel); border-radius: 5px; overflow: hidden; }
.meter-fill {
    height: 100%; width: 0%;
    background: var(--text-muted);
    transition: width 0.08s linear, background var(--d-fast) var(--e-out);
}
.meter-fill.gate-open { background: var(--success); }

.advanced summary {
    cursor: pointer; font-size: 0.85rem; color: var(--text-muted);
    padding: 0.25rem 0; user-select: none;
}
.advanced summary:hover { color: var(--text-main); }
.advanced .setting-group { margin-top: 0.75rem; }
.advanced .btn { align-self: flex-start; margin-top: 0.4rem; }

/* ---------- Profil ---------- */
.profile-top { display: flex; gap: 1rem; align-items: flex-start; }
.profile-top-right { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; flex: 1; }

.color-row { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.color-dot {
    width: 24px; height: 24px; border-radius: 50%;
    border: 2px solid transparent; cursor: pointer; padding: 0;
}
.color-dot.selected { border-color: var(--text-main); transform: scale(1.1); }

.avatar-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.avatar-actions .btn { cursor: pointer; }

.profile-stats {
    display: flex; gap: 0.5rem;
    background: var(--bg-darker); border-radius: var(--radius); padding: 0.8rem;
}
.stat { flex: 1; text-align: center; min-width: 0; }
.stat-val { display: block; font-weight: 600; font-size: 0.92rem; }
.stat-label { display: block; font-size: 0.68rem; color: var(--text-muted); margin-top: 0.15rem; }

.profile-view { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; text-align: center; }
.profile-view h3 { font-size: 1.15rem; }
.profile-actions { display: flex; flex-direction: column; gap: 0.4rem; width: 100%; margin-top: 0.5rem; }
.profile-actions.admin-actions { border-top: 1px solid var(--border); padding-top: 0.6rem; }
.admin-actions-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 0.1rem; }
.profile-view .presence { font-size: 0.8rem; color: var(--text-muted); }
.profile-view .pv-banner { width: 100%; height: 76px; border-radius: 12px; margin-bottom: -52px; }
.profile-view .pv-avatar { display: inline-flex; border: 5px solid var(--bg-dark); border-radius: 50%; --pdot-bg: var(--bg-dark); }
.profile-view .status-text { font-size: 0.85rem; color: var(--accent); }
.profile-view .bio { font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; margin-top: 0.3rem; }
.profile-view .profile-stats { width: 100%; margin-top: 0.6rem; }

/* ---------- Toast ---------- */
.toast-container {
    position: fixed; z-index: 4000;
    bottom: calc(1rem + var(--safe-bottom)); left: 50%;
    transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 0.5rem;
    align-items: center; pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
    background: var(--bg-panel); color: var(--text-main);
    padding: 0.7rem 1.1rem; border-radius: 10px;
    font-size: 0.85rem; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    opacity: 0; transform: translateY(12px);
    transition: opacity var(--d-base) var(--e-in), transform var(--d-base) var(--e-in);
    border-left: 3px solid var(--primary); max-width: 100%;
}
.toast.show {
    opacity: 1; transform: translateY(0);
    transition: opacity var(--d-slow) var(--e-out), transform var(--d-slow) var(--e-out);
}
.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-warn    { border-left-color: var(--warn); }

#audio-sinks { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-panel); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* =========================================================================
   Mobil - uygulama gorunumu
   ========================================================================= */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        border-right: none;
        position: absolute; inset: 0; z-index: 10;
    }
    .chat-area {
        position: absolute; inset: 0; z-index: 20;
        transform: translateX(100%);
        transition: transform var(--d-slow) var(--e-out);
    }
    /* Odaya girilince sohbet paneli one gelir, geri tusu listeye dondurur */
    body.mobile-chat .chat-area { transform: translateX(0); }
    .chat-area:has(> .call-stage:not(.hidden)) { flex-direction: column; }
    .chat-area:has(> .call-stage:not(.hidden)) > .chat-pane {
        flex: 1 1 auto; border-left: none; border-top: 1px solid var(--border);
    }
    .chat-area:has(> .call-stage:not(.hidden)) > .chat-pane > * { min-width: 0; }
    .chat-area.chat-closed:has(> .call-stage:not(.hidden)) > .chat-pane { display: none; }
    .call-stage { flex: 0 0 45%; }
    .chat-area.chat-closed > .call-stage { flex: 1; }
    /* Geri dugmesi sahnede en ustte; sohbet basligindaki ikinci kopya gereksiz */
    .chat-area:has(> .call-stage:not(.hidden)) #btn-back { display: none; }

    .mobile-only { display: inline-flex; }
    .modal-content, .overlay-content { padding: 1.3rem; }
    .form-row { flex-direction: column; gap: 0.9rem; }
    .messages { padding: 1rem; }
    .profile-stats { flex-wrap: wrap; }
}

/* ---------- Hareket: acilis animasyonlari ----------
   Eleman gorunur oldugu an (DOM'a eklenince ya da .hidden kalkinca) bir kez oynar.
   Kapanis animasyonsuz: .hidden/remove() anlik. */
.ctx-menu, .emoji-picker, .server-hover, .mention-suggest {
    animation: pop-in var(--d-base) var(--e-out);
}
.ctx-menu { transform-origin: top left; }
.server-hover { transform-origin: left center; }
.emoji-picker, .mention-suggest { transform-origin: bottom center; }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } }

.overlay, .modal { animation: fade-in var(--d-slow) var(--e-out); }
.overlay-content, .modal-content { animation: modal-in var(--d-slow) var(--e-out); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }

.btn:active:not(:disabled), .icon-btn:active:not(:disabled) { transform: scale(.96); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* =========================================================================
   v4 - Sunucular, uyeler, roller, davetler
   ========================================================================= */

/* ---------- Sunucu rayi ---------- */
.server-rail-wrap {
    width: 68px; flex-shrink: 0;
    background: var(--bg-rail);
    display: flex; flex-direction: column; align-items: center;
    gap: 0.5rem; padding: 0.6rem 0;
    padding-top: calc(0.6rem + var(--safe-top));
    padding-bottom: calc(0.6rem + var(--safe-bottom));
    padding-left: var(--safe-left);
    border-right: 1px solid var(--border);
    overflow-y: auto; overflow-x: hidden;
}
.server-rail { display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }

.server-icon {
    width: 46px; height: 46px; flex-shrink: 0;
    border-radius: 16px; border: none; cursor: pointer;
    color: #fff; font-weight: 700; font-size: 0.95rem;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative;
    transition: border-radius var(--d-base) var(--e-out), transform var(--d-base) var(--e-out);
    font-family: inherit;
}
.server-icon:hover { border-radius: 12px; }
.server-icon.active { border-radius: 12px; }
.server-icon.active::before {
    content: ''; position: absolute; left: -11px; top: 50%; transform: translateY(-50%);
    width: 4px; height: 26px; background: var(--text-main); border-radius: 0 3px 3px 0;
}
.server-icon img { width: 100%; height: 100%; object-fit: cover; }
.server-icon.add {
    background: var(--bg-panel); color: var(--success);
    font-size: 1.4rem; font-weight: 400; line-height: 1;
}
.server-icon.add:hover { background: var(--success); color: #fff; }

/* Sunucu hover karti (dolu ses kanallari) */
.server-hover {
    position: fixed; z-index: 3500; pointer-events: none;
    min-width: 200px; max-width: 260px; padding: 0.6rem 0.75rem;
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: var(--shadow); font-size: 0.85rem;
}
.server-hover .sh-title { font-weight: 700; margin-bottom: 0.35rem; }
.server-hover .sh-role { color: var(--text-muted); font-weight: 400; font-size: 0.75rem; }
.server-hover .sh-ch {
    display: flex; justify-content: space-between; gap: 0.5rem;
    color: var(--text-muted); font-size: 0.75rem; margin: 0.5rem 0 0.25rem;
}
.server-hover .sh-ch span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-hover .sh-stack { display: flex; }
.server-hover .sh-stack .avatar { border: 2px solid var(--bg-panel); flex-shrink: 0; }
.server-hover .sh-stack .avatar + .avatar { margin-left: -6px; }
.server-hover .sh-more { background: var(--bg-hover); color: var(--text-main); }
.server-hover .sh-empty { color: var(--text-muted); font-size: 0.8rem; }

/* ---------- Bos durum ---------- */
.empty-state {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 0.6rem; padding: 1.5rem; text-align: center;
}
.empty-state h3 { font-size: 1rem; }
.empty-state p { color: var(--text-muted); font-size: 0.85rem; line-height: 1.5; margin-bottom: 0.5rem; }
.empty-hint.small { padding: 0.75rem; font-size: 0.78rem; }

/* ---------- Rozet ---------- */
.badge {
    background: var(--bg-panel); color: var(--text-muted);
    font-size: 0.62rem; font-weight: 600;
    padding: 0.05rem 0.3rem; border-radius: 8px; margin-left: 0.15rem;
}

/* ---------- Roller ---------- */
.role-badge {
    font-size: 0.66rem; font-weight: 600;
    padding: 0.15rem 0.45rem; border-radius: 20px;
    background: var(--bg-panel); color: var(--text-muted);
    white-space: nowrap;
}
.role-badge.role-owner     { background: rgba(234,179,8,0.18);  color: #eab308; }
.role-badge.role-admin     { background: rgba(168,85,247,0.18); color: #c084fc; }
.role-badge.role-moderator { background: rgba(14,165,233,0.18); color: #38bdf8; }

.role-select {
    background: var(--bg-darker); border: 1px solid var(--border);
    color: var(--text-main); border-radius: 6px;
    padding: 0.25rem 0.4rem; font-size: 0.72rem; width: auto; min-width: 96px;
}

/* ---------- Uye listesi ---------- */
.members-list { display: flex; flex-direction: column; gap: 0.2rem; max-height: 55vh; overflow-y: auto; }

.member-row {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.5rem; border-radius: 8px;
}
.member-row:hover { background: var(--bg-darker); }
.member-info { flex: 1; min-width: 0; cursor: pointer; }
.member-name {
    font-size: 0.88rem; font-weight: 500;
    display: flex; align-items: center; gap: 0.35rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.member-name em { font-style: normal; opacity: 0.55; font-size: 0.75rem; }
.member-sub { font-size: 0.72rem; color: var(--text-muted); }
.member-actions { display: flex; align-items: center; gap: 0.3rem; flex-shrink: 0; }

.presence-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted); flex-shrink: 0;
}
.presence-dot.online { background: var(--success); }

/* ---------- Davetler ---------- */
.copy-row { display: flex; gap: 0.5rem; }
.copy-row input {
    flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem; min-width: 0;
}
.copy-row .btn { flex-shrink: 0; }

.invite-list { display: flex; flex-direction: column; gap: 0.3rem; max-height: 30vh; overflow-y: auto; }

.invite-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.5rem; padding: 0.5rem 0.6rem;
    background: var(--bg-darker); border-radius: 8px;
}
.invite-row-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.invite-row code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem; color: var(--text-main);
}
.invite-row .muted { font-size: 0.7rem; }
.invite-row-actions { display: flex; gap: 0.2rem; flex-shrink: 0; }

/* ---------- Onay kutusu ---------- */
.checkbox-row {
    display: flex; align-items: center; gap: 0.6rem;
    font-size: 0.85rem; cursor: pointer; padding: 0.2rem 0;
}
.checkbox-row input[type="checkbox"] {
    width: 18px; height: 18px; flex-shrink: 0;
    accent-color: var(--primary); cursor: pointer;
}

/* ---------- Tehlikeli bolge ---------- */
.danger-zone { display: flex; flex-direction: column; gap: 0.5rem; }

select {
    background: var(--bg-darker); border: 1px solid var(--border);
    color: var(--text-main); padding: 0.7rem 0.8rem;
    border-radius: 8px; font-size: 16px; width: 100%; font-family: inherit;
}

/* ---------- Mobil ---------- */
@media (max-width: 768px) {
    .server-rail-wrap { width: 58px; }
    .server-icon { width: 40px; height: 40px; font-size: 0.85rem; }
    /* Sunucu rayi mobilde de hep gorunur kalsin */
    .sidebar   { left: 58px; width: auto; right: 0; }
    .chat-area { left: 58px; right: 0; width: auto; }
    .members-list { max-height: 60vh; }
    .member-actions { flex-direction: column; align-items: flex-end; gap: 0.2rem; }
    .copy-row { flex-direction: column; }
    .copy-row .btn { width: 100%; }
}

/* ---------- Masaustu uygulamasi ---------- */
.desktop-info {
    background: var(--bg-darker); border-radius: 8px;
    padding: 0.6rem 0.75rem; font-size: 0.8rem;
    display: flex; flex-direction: column; gap: 0.25rem;
}
.desktop-info b { word-break: break-all; }

.tech-info-grid {
    background: var(--bg-darker); border-radius: 8px;
    padding: 0.6rem 0.75rem; font-size: 0.8rem;
    display: flex; flex-direction: column; gap: 0.25rem;
}

/* Masaustunde tarayiciya ozel ogeler gizlenir */
body.is-desktop #btn-install { display: none !important; }

/* ---------- Davet adresi durumu ---------- */
.address-status {
    font-size: 0.76rem; line-height: 1.5;
    border-radius: 8px; padding: 0.55rem 0.7rem;
    display: flex; gap: 0.5rem; align-items: flex-start;
}
.address-status .ico { flex: none; }
.address-status.ok    { background: rgba(34,197,94,0.12);  color: var(--ok-text); }
.address-status.warn  { background: rgba(245,158,11,0.12); color: var(--warn-text); }
.address-status.error { background: rgba(239,68,68,0.12);  color: var(--danger-text); }
.address-status b { color: inherit; }
.address-status code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.72rem; word-break: break-all;
}

/* =======================================================================
   DM PANEL
   ======================================================================= */
.dm-panel { padding: 0.5rem; }
.dm-search { padding: 0 0 0.5rem; }
.dm-search input {
    width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border);
    border-radius: 6px; background: var(--bg-dark); color: var(--text);
    font-size: 0.85rem; outline: none;
}
.dm-search input:focus { border-color: var(--primary); }
.dm-list { display: flex; flex-direction: column; gap: 2px; }
.dm-item {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0.6rem; border-radius: 6px; cursor: pointer;
    transition: background var(--d-fast) var(--e-out);
}
.dm-item:hover { background: rgba(var(--ov), 0.06); }
.dm-item.active { background: rgba(99,102,241,0.15); }
.dm-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.8rem; color: #fff; flex-shrink: 0;
}
.dm-info { flex: 1; min-width: 0; }
.dm-name { font-size: 0.85rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-last { font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-unread {
    background: var(--danger, #ef4444); color: #fff; border-radius: 10px;
    padding: 1px 6px; font-size: 0.7rem; font-weight: 600; min-width: 18px;
    text-align: center;
}
.dm-empty { text-align: center; padding: 2rem 1rem; color: var(--muted); font-size: 0.85rem; }

.notif-title { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 0.6rem 0.2rem 0.3rem; }
.friend-req-row {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0.6rem; border-radius: 6px; cursor: default;
}
.friend-req-row:hover { background: rgba(var(--ov), 0.06); }
.freq-name { font-size: 0.85rem; font-weight: 500; color: var(--text); }
.freq-actions { margin-left: auto; display: flex; gap: 0.3rem; }
.freq-accept, .freq-decline { background: none; border: none; cursor: pointer; font-size: 0.95rem; padding: 0.2rem; border-radius: 6px; }
.freq-accept:hover, .freq-decline:hover { background: rgba(var(--ov), 0.1); }
.freq-empty { text-align: center; padding: 1.2rem 1rem; color: var(--text-muted); font-size: 0.82rem; }

.bans-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.ban-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.3rem; border-radius: 6px; }
.ban-row:hover { background: rgba(var(--ov), 0.05); }
.ban-name { flex: 1; font-size: 0.85rem; }

.mention-row { cursor: pointer; }
.mention-row.unread { background: rgba(99,102,241,0.08); }
.mention-info { min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.mention-preview { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =======================================================================
   ATTACHMENT PREVIEW (onizleme)
   ======================================================================= */
.attach-preview {
    padding: 0.5rem 0.75rem;
    background: rgba(0,0,0,0.15); border-radius: 8px 8px 0 0;
    margin-bottom: -1px;
}
.pv-body {
    display: flex; align-items: center; gap: 0.6rem;
    background: rgba(0,0,0,0.2); border-radius: 6px;
    padding: 0.5rem;
}
.pv-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; }
.pv-ico { font-size: 1.5rem; }
.pv-info { flex: 1; min-width: 0; }
.pv-name { font-size: 0.8rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-size { font-size: 0.7rem; color: var(--muted); }
.pv-bar { height: 3px; background: rgba(var(--ov), 0.1); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.pv-bar-fill { height: 100%; background: var(--primary); transition: width var(--d-fast) var(--e-out); }
.pv-remove {
    background: none; border: none; color: var(--muted); cursor: pointer;
    font-size: 1.1rem; padding: 4px; transition: color var(--d-fast) var(--e-out);
}
.pv-remove:hover { color: var(--danger, #ef4444); }

/* =======================================================================
   RECORD BAR (sesli mesaj kaydi)
   ======================================================================= */
.record-bar {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    background: rgba(239,68,68,0.08);
    border-radius: 8px 8px 0 0; margin-bottom: -1px;
}
.rec-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #ef4444; animation: rec-pulse 1s infinite;
}
@keyframes rec-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.rec-time { font-size: 0.85rem; font-weight: 600; color: var(--text); min-width: 3em; }
.rec-label { font-size: 0.8rem; color: var(--muted); flex: 1; }
.icon-btn.chat-tool.recording { color: #ef4444; animation: rec-pulse 1s infinite; }

/* =======================================================================
   ATTACHMENTS (mesaj icindeki ekler)
   ======================================================================= */
.att { margin-top: 0.4rem; }
.att-image img {
    max-width: min(400px, 100%); max-height: 300px;
    border-radius: 6px; cursor: pointer; object-fit: contain;
    transition: transform var(--d-fast) var(--e-out);
}
.att-image img:hover { transform: scale(1.02); }
.att-audio {
    display: flex; align-items: center; gap: 0.5rem;
    background: rgba(0,0,0,0.15); border-radius: 8px; padding: 0.4rem 0.6rem;
}
.att-audio audio { flex: 1; height: 32px; }
.att-dur { font-size: 0.75rem; color: var(--muted); }
.att-ico { font-size: 1.3rem; }
.att-video video {
    max-width: min(400px, 100%); max-height: 300px;
    border-radius: 6px;
}
.att-file {
    display: flex; align-items: center; gap: 0.5rem;
    background: rgba(0,0,0,0.15); border-radius: 8px; padding: 0.5rem 0.6rem;
    color: var(--text); text-decoration: none; transition: background var(--d-fast) var(--e-out);
}
.att-file:hover { background: rgba(0,0,0,0.25); }
.att-info { flex: 1; min-width: 0; }
.att-name { font-size: 0.8rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-size { font-size: 0.7rem; color: var(--muted); }
.att-dl { font-size: 1rem; opacity: 0.6; }
.att-dl:hover { opacity: 1; }

/* =========================================================================
   YAPILACAKLAR LISTESI MESAJI - gorunum "C · Kompakt" (Napol 2026-10-07)
   ========================================================================= */
.cl-card { border-left: 3px solid var(--primary); padding: 0.15rem 0 0.15rem 0.75rem; max-width: 520px; margin-top: 0.1rem; }
.cl-title { font-weight: 600; font-size: 0.88rem; overflow-wrap: anywhere; }
.cl-progress { display: flex; align-items: center; gap: 0.6rem; font-size: 0.72rem; color: var(--text-muted); margin: 0.2rem 0 0.4rem; }
.cl-bar { flex: 1; max-width: 160px; height: 3px; border-radius: 4px; background: rgba(var(--ov), 0.08); overflow: hidden; }
.cl-bar i { display: block; height: 100%; background: var(--success); border-radius: inherit; transition: width var(--d-slow) var(--e-out); }
.cl-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; font-size: 0.9rem; }
.cl-item { display: flex; align-items: flex-start; gap: 0.6rem; }
.cl-item label { display: flex; align-items: flex-start; gap: 0.6rem; flex: 1; min-width: 0; cursor: pointer; }
.cl-text { overflow-wrap: anywhere; transition: color var(--d-base) var(--e-out); }
.cl-item.done .cl-text { text-decoration: line-through; text-decoration-color: rgba(var(--ov), 0.4); color: var(--text-muted); }
.cl-by { flex: none; font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.cl-items input[type=checkbox] {
    appearance: none; -webkit-appearance: none; margin: 2px 0 0; flex: none; cursor: pointer;
    width: 16px; height: 16px; border-radius: 5px; border: 1.75px solid rgba(var(--ov), 0.35);
    display: grid; place-items: center;
    transition: background var(--d-fast) var(--e-out), border-color var(--d-fast) var(--e-out);
}
.cl-items input[type=checkbox]::after {
    /* Tabler check (veri URI maske - <use> ::after icine konamaz) */
    content: ''; width: 10px; height: 10px; transform: scale(0); transition: transform var(--d-base) var(--e-out); background: #fff;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5l10 -10'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5l10 -10'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cl-items input[type=checkbox]:checked { background: var(--primary); border-color: var(--primary); }
.cl-items input[type=checkbox]:checked::after { transform: scale(1); }
.cl-items input[type=checkbox]:hover:not(:disabled) { border-color: var(--primary); }
.cl-items input[type=checkbox]:disabled { cursor: default; opacity: 0.55; }
.cl-items input[type=checkbox]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Liste penceresi */
.checklist-modal input[type=text] {
    font: inherit; color: var(--text-main); background: var(--bg-darker); border: 1px solid var(--border);
    border-radius: 8px; padding: 0.55rem 0.7rem; width: 100%; outline: none; transition: border-color var(--d-fast) var(--e-out);
}
.checklist-modal input[type=text]:focus { border-color: var(--primary); }
#checklist-title { font-weight: 600; margin-bottom: 0.8rem; }
.cl-edit-items { display: grid; gap: 0.4rem; max-height: 50vh; overflow-y: auto; padding: 2px; }
.cl-edit-row { display: flex; align-items: center; gap: 0.55rem; }
.cl-edit-row input[type=checkbox] {
    appearance: none; -webkit-appearance: none; margin: 0; flex: none; width: 18px; height: 18px;
    border-radius: 5px; border: 1.75px solid rgba(var(--ov), 0.25);
}
.cl-edit-row input[type=checkbox]:checked { background: var(--primary); border-color: var(--primary); }
.cl-edit-row input[type=text] { padding: 0.45rem 0.6rem; }
.checklist-modal .msg-modal-actions { align-items: center; }
.checklist-modal .msg-modal-actions .muted { margin-right: auto; font-size: 0.78rem; }
