/*  Sohbet: mesajlar, ekler, emoji, etiketler, tepkiler, anket, liste, sabitlenenler, fotograf goruntuleyici  */

/* ---------- 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 0.9rem; min-height: 46px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-dark);
    display: flex; align-items: center; gap: 0.6rem;
}

.chat-header h3 { font-size: 0.92rem; white-space: nowrap; }

.chat-header h3.room-hash::before { content: '#'; color: var(--text-muted); font-weight: 500; margin-right: 0.35rem; }

/* Ad ve konu tek satirda; konu yoksa yalniz ad */

.chat-header-text { min-width: 0; display: flex; align-items: baseline; gap: 0.6rem; }

.messages {
    flex: 1; overflow-y: auto; padding: 1.2rem;
    display: flex; flex-direction: column; gap: var(--msg-group-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);
}

.message { display: flex; gap: 0.65rem; align-items: flex-start; position: relative; padding: 0.15rem 2.2rem 0.15rem 0; border-radius: var(--radius); }

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

.msg-time { font-size: 0.7rem; color: var(--text-muted); }

.msg-content { font-size: var(--msg-size, 0.92rem); line-height: 1.45; word-break: break-word; white-space: pre-wrap; }

.msg-content a { color: var(--primary-ink); }

.msg-content .mention { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary-ink); border-radius: var(--radius); 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: var(--radius); 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: var(--radius);
    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, .msg-reply-ref .avatar { flex-shrink: 0; }

.message.highlight-flash { animation: msgFlash 1.6s var(--e-out); }

@keyframes msgFlash { 0%, 40% { background: color-mix(in srgb, var(--primary) 22%, transparent); } 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; }

/* Art arda mesaj grubu (groupWithPrev): .messages gap'i 0.9rem, devam satiri ustundekine yapisir */

/* Devam satiri ile ustu arasi --msg-line-gap kalir (varsayilan 0.15rem); grup boslugu ne olursa olsun */
.message.msg-cont { margin-top: calc(var(--msg-line-gap, 0.15rem) - var(--msg-group-gap, 0.9rem)); }

/* Mesaj araligi (Ayarlar > Gorunum): Rahat satirlari acar; Sikisik avatari gizler, ad ve mesaj ayni satirda */
html[data-msg-density="cozy"] { --msg-line-gap: 0.4rem; }
html[data-msg-density="compact"] { --msg-line-gap: 0rem; }
html[data-msg-density="compact"] .message > .avatar { display: none; }
html[data-msg-density="compact"] .message.msg-cont > .msg-body { margin-left: 0; }
html[data-msg-density="compact"] .message.msg-cont::before { display: none; }
html[data-msg-density="compact"] .message:not(.msg-cont) .msg-header { display: inline-flex; margin-right: 0.45rem; }
html[data-msg-density="compact"] .message:not(.msg-cont) .msg-header + .msg-content { display: inline; }

/* avatar satir ici 32px boyutlu: gizle, yerini govdenin sol boslugu tutsun (32px + .message gap) */

.message.msg-cont > .avatar { display: none; }

.message.msg-cont > .msg-body { margin-left: calc(32px + 0.65rem); }

.message.msg-cont .msg-header { display: none; }

.message.msg-cont::before {
    content: attr(data-hm); position: absolute; left: 0; top: 0.35rem; width: 32px; text-align: center;
    font-size: 0.62rem; color: var(--text-muted); opacity: 0;
}

.message.msg-cont:hover::before { opacity: 1; }

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

/* Gun ayraci (bkz. app.js addDaySep): ince cizgi, ortada Bugun / Dun / tarih */

.day-sep { display: flex; align-items: center; gap: .75rem; margin: .9rem 0 .4rem; font-size: .72rem; font-weight: 600; color: var(--text-muted); }

.day-sep::before, .day-sep::after { content: ''; flex: 1; border-top: 1px solid var(--border); }

.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: var(--radius); 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-ink); cursor: pointer; }

.msg-modal-hint { color: var(--text-muted); font-size: .88rem; margin-bottom: .6rem; }

.msg-modal-preview { background: var(--bg-darker); border-radius: var(--radius); 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: var(--radius); 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: var(--on-primary); border: none; border-radius: var(--radius);
    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: var(--radius); 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: var(--radius); 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: color-mix(in srgb, var(--primary) 20%, transparent); border-color: var(--primary); }

.reply-preview, .attach-preview {
    display: flex; align-items: center; gap: 0.5rem; background: rgba(var(--ov), 0.05);
    border-radius: var(--radius); 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: var(--radius); 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: var(--radius); 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: var(--radius); 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: var(--radius);
    padding: 0.25rem 0; line-height: 1.2; font-family: var(--font-emoji);
}

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

.emoji-section.no-items, .emoji-tab.no-items { display: none; }

.emoji-subhead { font-size: 0.66rem; color: var(--text-muted); margin: 0.35rem 0.25rem 0.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.emoji-opt.custom { display: flex; align-items: center; justify-content: center; }

.emoji-opt.custom .cemoji { width: 28px; height: 28px; }

.cemoji { width: 1.45em; height: 1.45em; object-fit: contain; vertical-align: -0.35em; margin: 0 0.05em; }

.cemoji.big { width: 3rem; height: 3rem; vertical-align: middle; }

.reaction-pill .cemoji { width: 1.15em; height: 1.15em; vertical-align: middle; margin: 0; }

.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-h: tek satirlik kutu yuksekligi; dugmeler alta yaslanir, kutu cok satirda yukari buyur */
#chat-form { display: flex; gap: 0.5rem; align-items: flex-end; --chat-h: 3.2rem; }

#chat-input {
    flex: 1; background: var(--bg-panel); border: 1px solid transparent;
    padding: 0.85rem 1rem; border-radius: var(--radius);
    /* Shift+Enter ile cok satir: kutu yaziyla buyur (field-sizing), 8 satirdan sonra kayar */
    resize: none; field-sizing: content; min-height: var(--chat-h); max-height: 14rem; overflow-y: auto;
    font: inherit; line-height: 1.4; color: inherit;
}
/* Bosken tek satir: dar sutunda uzun yer tutucu kutuyu uzatmasin */
#chat-input:placeholder-shown { height: var(--chat-h); overflow: hidden; }

#chat-input:focus { border-color: var(--primary); }

.send-btn { padding: 0 1.1rem; flex-shrink: 0; height: var(--chat-h); }

@media (max-width: 768px) {
    .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; }
}

@media (max-width: 768px) {
    .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; }
}

@media (max-width: 768px) {
    .messages { padding: 1rem; }
}

.emoji-picker {
    animation: pop-in var(--d-base) var(--e-out);
}

.mention-suggest {
    animation: pop-in var(--d-base) var(--e-out);
}

.emoji-picker, .mention-suggest { transform-origin: bottom center; }

@media (max-width: 768px) {
    .chat-area { left: 0; right: 0; width: auto; padding-left: var(--safe-left); }

    /* Mesaj kutusu: telefonda dosya / sesli mesaj da "+" menusune girer (app.js btnChatMore), kutuya yer kalsin */
    #chat-form > #btn-attach, #chat-form > #btn-record { display: none; }
    #chat-form { gap: 0.35rem; align-items: flex-end; }
    .chat-input-area { padding-left: 0.6rem; padding-right: 0.6rem; }
    #chat-input { min-width: 0; padding: 0.75rem 0.85rem; }
    .send-btn { padding: 0 0.9rem; }
}

/* Tablet / dar pencere: sohbet sutunu darsa (kanal listesi + uye paneli acikken) dosya ve sesli mesaj da
   "+" menusune girer; yazi kutusu 150px'e kadar sikisiyordu. Menu gizli dugmeleri kendisi toplar (composer.js). */
.chat-input-area { container-type: inline-size; }
@container (max-width: 560px) {
    #chat-form > #btn-attach, #chat-form > #btn-record { display: none; }
    #chat-input { min-width: 0; }
}

.mention-row { cursor: pointer; }

.mention-row.unread { background: color-mix(in srgb, var(--primary) 8%, transparent); }

.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: var(--radius);
    margin-bottom: -1px;
}

/* =======================================================================
   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: var(--radius); margin-bottom: -1px;
}

.rec-dot {
    width: 10px; height: 10px; border-radius: var(--radius);
    background: #ef4444; animation: rec-pulse 1s infinite;
}

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

/* Anket, liste gibi ozellikler kutuyu saga dogru uzatmasin: yalnizca "+" menusunden acilir */

#chat-form > .in-more-menu { display: none; }

/* =======================================================================
   ATTACHMENTS (mesaj icindeki ekler)
   ======================================================================= */

.att { margin-top: 0.4rem; }

.att-image img {
    max-width: min(400px, 100%); max-height: 300px;
    border-radius: var(--radius); 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: var(--radius); 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: var(--radius);
}

.att-file {
    display: flex; align-items: center; gap: 0.5rem;
    background: rgba(0,0,0,0.15); border-radius: var(--radius); 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: var(--radius); background: rgba(var(--ov), 0.08); overflow: hidden; }

.cl-bar i { display: block; height: 100%; background: var(--success); border-radius: var(--radius); transition: width var(--d-slow) var(--e-out); }

.cl-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.375rem; 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; }

/* Satir yuksekligi 22px + 18px kutu (margin-top 2px): kutu her zaman ilk satirin ortasinda */

.cl-text { line-height: 22px; overflow-wrap: anywhere; white-space: pre-wrap; 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); line-height: 22px; }

.cl-items input[type=checkbox] {
    /* padding 0: genel input kurali (0.7rem 0.8rem) kutuyu 28x24 hapa ceviriyordu */
    appearance: none; -webkit-appearance: none; margin: 2px 0 0; padding: 0; flex: none; cursor: pointer;
    width: 18px; height: 18px; border-radius: 6px; 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: var(--on-primary);
    -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: var(--radius); 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; padding: 0; flex: none; width: 18px; height: 18px;
    border-radius: 6px; 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 textarea { flex: 1; padding: 0.45rem 0.6rem; resize: none; field-sizing: content; min-height: 0; max-height: 10rem; font: inherit; line-height: 1.4; }
/* Surukleme tutamagi; suruklenen satir soluk */
.cl-grip { flex: none; display: grid; place-items: center; width: 16px; height: 28px; margin-right: -0.25rem; color: var(--text-muted); cursor: grab; opacity: .55; touch-action: none; }
.cl-edit-row:hover .cl-grip, .cl-edit-row:focus-within .cl-grip { opacity: 1; }
.cl-grip:active { cursor: grabbing; }
.cl-edit-row.dragging, .cl-item.dragging { opacity: .4; }
/* Kartta tutamak: satir ustune gelince belirir */
.cl-item .cl-grip { height: 20px; margin: 0 -0.35rem 0 -0.2rem; opacity: 0; }
.cl-item:hover .cl-grip, .cl-item:focus-within .cl-grip { opacity: .7; }
@media (hover: none) { .cl-item .cl-grip { opacity: .5; } }

.checklist-modal .msg-modal-actions { align-items: center; }

.checklist-modal .msg-modal-actions .muted { margin-right: auto; font-size: 0.78rem; }

/* ---------- Sohbet basligi eylemleri ---------- */

.chat-header-actions { margin-left: auto; display: flex; gap: 0.4rem; flex: none; }

/* Sohbetteki yazar adi tiklanabilir */

.msg-author { cursor: pointer; }

.msg-author:hover { text-decoration: underline; }

/* ---------- Sohbet araclari (ek / sesli mesaj) ---------- */

.chat-tool { flex: none; }

.attach-preview {
    background: var(--bg-darker); border-radius: var(--radius);
    padding: 0.5rem; margin-bottom: 0.5rem;
    display: flex; gap: 0.5rem; overflow-x: auto;
}

.attach-preview.hidden { display: none; }

.chat-area.drop-target { outline: 2px dashed var(--primary); outline-offset: -8px; }

.send-btn:disabled { opacity: 0.55; cursor: progress; }

/* ---------- Sesli mesaj kaydi ---------- */

.record-bar {
    display: flex; align-items: center; gap: 0.6rem;
    background: rgba(239,68,68,.12); border-radius: var(--radius);
    padding: 0.6rem 0.75rem; margin-bottom: 0.5rem;
}

.rec-dot {
    width: 10px; height: 10px; border-radius: var(--radius); background: var(--danger);
    animation: rec-pulse 1s infinite; flex: none;
}

.rec-time { font-family: var(--font-mono); font-size: 0.9rem; font-weight: 600; }

.rec-label { font-size: 0.78rem; color: var(--text-muted); flex: 1; }

/* ---------- Mesaj ekleri ---------- */

.att { margin-top: 0.4rem; }

.att-image img {
    max-width: min(320px, 100%); max-height: 320px;
    border-radius: var(--radius); cursor: zoom-in; display: block;
    /* Arka plan yok: seffaf PNG/WebP'nin arkasi sohbetin kendi zemini gibi gorunsun */
}

.att-audio {
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--bg-darker); border-radius: var(--radius); padding: 0.5rem 0.7rem;
    max-width: 360px;
}

.att-audio audio { flex: 1; height: 34px; min-width: 0; }

.att-dur { font-size: 0.72rem; color: var(--text-muted); flex: none; }

.att-video video { max-width: min(360px, 100%); border-radius: var(--radius); display: block; }

.att-file {
    display: flex; align-items: center; gap: 0.7rem; text-decoration: none;
    background: var(--bg-darker); border-radius: var(--radius); padding: 0.65rem 0.8rem;
    color: var(--text-main); max-width: 360px;
}

.att-file:hover { background: var(--bg-panel); }

.att-ico { font-size: 1.4rem; flex: none; }

.att-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.att-name { font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.att-size { font-size: 0.7rem; color: var(--text-muted); }

.att-dl { flex: none; opacity: .7; }

/* ---------- Fotograf buyutme ---------- */

/* ---------- Fotograf goruntuleyici (tam ekran) ---------- */

.lightbox {
    position: fixed; inset: 0; z-index: 6000;
    background: rgba(0,0,0,.92); display: flex; flex-direction: column;
    animation: lbIn var(--d-base) var(--e-out);
}

@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox-bar {
    display: flex; align-items: center; gap: .4rem;
    padding: calc(.6rem + var(--safe-top, 0px)) .8rem .6rem .9rem;
    color: #fff; flex-shrink: 0;
}

.lightbox-name {
    flex: 1; min-width: 0; font-size: .85rem; opacity: .8;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.lightbox-btn {
    background: rgba(255,255,255,.1); border: none; color: #fff; text-decoration: none;
    width: 40px; height: 40px; border-radius: var(--radius); cursor: pointer; font-size: 1.05rem;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.lightbox-btn:hover { background: rgba(255,255,255,.24); }

.lightbox-level { width: auto; min-width: 52px; padding: 0 .5rem; font-size: .8rem; font-variant-numeric: tabular-nums; }

.lightbox-stage {
    flex: 1; min-height: 0; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    padding: 0 1rem 1rem;
    touch-action: none;   /* iki parmak / surukleme tarayiciya degil goruntuleyiciye */
}

/* Yakinlastirma transform ile (app.js applyLightboxView): olcek 1 = ekrana sigmis hali */

.lightbox-stage img {
    max-width: 100%; max-height: 100%; object-fit: contain;
    cursor: zoom-in; user-select: none; -webkit-user-drag: none;
    transform-origin: center center; will-change: transform;
}

.lightbox-stage.zoomed img { cursor: grab; }

.lightbox-stage.dragging img { cursor: grabbing; }

body.lightbox-open { overflow: hidden; }

/* =======================================================================
   @ETIKET: tiklanabilir + oneriler
   ======================================================================= */

.msg-content .mention.user { cursor: pointer; }

/* Rol etiketi: rolun rengi (yoksa ana renk); benim rolumse sari 'me' vurgusu kazanir */
.msg-content .mention.role:not(.me) { color: var(--role-color, var(--primary-ink)); background: color-mix(in srgb, var(--role-color, var(--primary)) 18%, transparent); }

.msg-content .mention.user:hover { text-decoration: underline; }

.chat-input-area { position: relative; }

.mention-suggest {
    position: absolute; left: 1.2rem; right: 1.2rem; bottom: calc(100% - 0.4rem); z-index: 50;
    background: var(--bg-dark); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; padding: 0.35rem;
}

.mention-suggest-title {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--text-muted); padding: 0.3rem 0.5rem 0.35rem;
}

.mention-opt {
    display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left;
    background: none; border: none; color: var(--text-main); cursor: pointer; font-family: inherit;
    padding: 0.4rem 0.5rem; border-radius: var(--radius);
}

.mention-opt.active, .mention-opt:hover { background: rgba(var(--ov), 0.08); }

.mention-opt .mo-name { font-weight: 600; font-size: 0.88rem; }

.mention-opt .mo-user { color: var(--text-muted); font-size: 0.78rem; margin-left: auto; }

.mention-opt .mo-everyone {
    width: 28px; height: 28px; border-radius: 50%; background: var(--bg-panel);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}

.mention-hint { color: var(--text-muted); font-size: 0.7rem; padding: 0.3rem 0.5rem 0.1rem; }

.mention-hint kbd {
    background: var(--bg-panel); border-radius: var(--radius); padding: 0 0.3rem; font-family: inherit; font-size: 0.68rem;
}

@media (max-width: 768px) {
    .mention-suggest { left: 0.6rem; right: 0.6rem; }
}

.chat-header .call-layout { margin-left: 0.4rem; }

.chat-area.resizing .call-splitter { background: var(--primary); }

.chat-area.resizing { cursor: col-resize; user-select: none; }

.chat-area.resizing > .chat-pane, .chat-area.resizing .video-grid > * { transition: none !important; }

@media (min-width: 769px) {
    /* Sohbet sutunu genisligi suruklenerek ayarlanan paydan gelir */
    .chat-area:has(> .call-stage:not(.hidden)) > .chat-pane {
        flex: 0 0 clamp(280px, calc(var(--call-chat-frac, 0.3) * 100%), 75%);
        border-left: none;
    }
    .chat-area:has(> .call-stage:not(.hidden)) > .chat-pane > * { min-width: 280px; }
}

/* Dar masaustu duzeni (yatay telefon, kucuk tablet): kanal listesi acikken sahne (240) + sohbet (280) sigmiyor,
   sohbet sutunu sagdan tasip gonder dugmesi kesiliyordu. Ikisi de biraz daha daralabilir. */
@media (min-width: 769px) and (max-width: 1100px) {
    .chat-area > .call-stage { min-width: 180px; }   /* video.css daha sonra yuklenir: ozgulluk gerekir */
    .chat-area:has(> .call-stage:not(.hidden)) > .chat-pane { flex-shrink: 1; min-width: 220px; }
    .chat-area:has(> .call-stage:not(.hidden)) > .chat-pane > * { min-width: 220px; }
    .chat-area.chat-closed:has(> .call-stage:not(.hidden)) > .chat-pane { min-width: 0; }
}

@media (min-width: 769px) {
    /* Ok basliklarin ustune binmesin */
    #main-view.sidebar-closed .chat-header { padding-left: 34px; }
}

/* Sohbet basligi: yavas mod rozeti */

.slowmode-badge {
    display: inline-flex; align-items: center; gap: 0.3rem; flex: none;
    font-size: 0.72rem; font-weight: 600; color: var(--warn);
    background: rgba(245,158,11,0.12); border-radius: var(--radius); padding: 0.2rem 0.55rem;
}

.slowmode-badge .i { width: 1.05em; height: 1.05em; }

/* =========================================================================
   ILETME: kisiler + kanallar, coklu secim
   ========================================================================= */

.fwd-list { max-height: 330px; }

.fwd-ch { align-items: center; gap: 0.55rem; }

.fwd-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fwd-name small { color: var(--text-muted); font-weight: 400; }

.fwd-check { color: var(--primary-ink); display: inline-flex; }

.fwd-count { margin-right: auto; font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; align-self: center; }

.emoji-upload { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.9rem; }

.emoji-upload label.btn { cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem; }

.emoji-admin-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.5rem; }

.emoji-admin-row {
    display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.65rem;
    background: var(--bg-darker); border: 1px solid var(--border); border-radius: var(--radius);
}

.emoji-admin-img { width: 40px; height: 40px; object-fit: contain; flex: none; }

.emoji-admin-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }

.emoji-admin-info b { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; }

.emoji-admin-name { padding: 0.3rem 0.5rem; font-size: 0.85rem; }

.emoji-gif-tag {
    display: inline-block; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.06em; padding: 0.05rem 0.3rem;
    border-radius: var(--radius); background: color-mix(in srgb, var(--primary) 25%, transparent); color: var(--text-main);
}

.poll-card {
    margin-top: 0.35rem; max-width: 460px; padding: 0.8rem 0.85rem 0.7rem; border-radius: var(--radius);
    background: var(--bg-dark); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.55rem;
}

.poll-head { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.95rem; line-height: 1.35; }

.poll-head .i { color: var(--primary-ink); flex: none; margin-top: 0.1rem; }

.poll-head b { overflow-wrap: anywhere; }

.poll-opts { display: flex; flex-direction: column; gap: 0.35rem; }

.poll-opt {
    position: relative; overflow: hidden; display: flex; align-items: center; gap: 0.5rem; width: 100%;
    padding: 0.55rem 0.7rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-darker);
    color: var(--text-main); font: inherit; font-size: 0.86rem; text-align: left; cursor: pointer;
    transition: border-color var(--d-fast) var(--e-out);
}

.poll-opt:hover:not(:disabled) { border-color: color-mix(in srgb, var(--primary) 60%, transparent); }

.poll-opt:disabled { cursor: default; }

.poll-opt > span:not(.poll-fill) { position: relative; z-index: 1; }

.poll-fill {
    position: absolute; inset: 0 auto 0 0; z-index: 0; border-radius: var(--radius);
    background: color-mix(in srgb, var(--primary) 18%, transparent); transition: width var(--d-slow) var(--e-out);
}

.poll-opt.mine { border-color: var(--primary); }

.poll-opt.mine .poll-fill { background: color-mix(in srgb, var(--primary) 32%, transparent); }

.poll-opt.winner { border-color: #eab308; }

.poll-opt.winner .poll-fill { background: color-mix(in srgb, #eab308 25%, transparent); }

.poll-mark {
    width: 18px; height: 18px; flex: none; border-radius: var(--radius); border: 2px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center; color: #fff;
}

.poll-opt.mine .poll-mark { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

.poll-mark .i { width: 12px; height: 12px; }

.poll-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.poll-pct { flex: none; font-weight: 700; font-size: 0.8rem; color: var(--text-muted); }

.poll-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; font-size: 0.74rem; color: var(--text-muted); }

.poll-end { background: none; border: none; color: var(--danger-text, #f87171); font: inherit; font-size: 0.74rem; font-weight: 600; cursor: pointer; padding: 0; }

.poll-card.ended .poll-head .i { color: var(--text-muted); }

.poll-edit-options { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; }

.poll-edit-row { display: flex; gap: 0.4rem; align-items: center; }

.poll-edit-row input { flex: 1; min-width: 0; }

.poll-form-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }

.poll-form-row .form-group { margin-bottom: 0; min-width: 140px; }

.poll-form-row .checkbox-row { margin-bottom: 0.6rem; }

.mention-opt .mo-emoji { width: 26px; height: 26px; flex: none; }

.msg-header .bot-tag { margin-left: 0.35rem; }

/* =========================================================================
   Oyunlar kanali (games.js): sohbetin yerine uyelerin oyunlari ve oyun sunuculari
   ========================================================================= */

.chat-pane.games-mode #chat-messages,
.chat-pane.games-mode #typing-indicator,
.chat-pane.games-mode .chat-input-area,
.chat-pane.games-mode #pins-panel,
.chat-pane.games-mode #btn-jump-now,
.chat-pane.games-mode #slowmode-badge { display: none; }

/* ---------- Fotograf kirpma (image-crop.js) ---------- */

.crop-overlay { z-index: 2000; }

/* Ayarlar penceresinin de ustunde */

.crop-box { max-width: none; width: auto; display: flex; flex-direction: column; align-items: center; gap: 0.9rem; }

.crop-box h2 { margin: 0; }

.crop-hint { margin: 0 !important; max-width: 46ch; }

.crop-stage { display: block; cursor: grab; touch-action: none; background: var(--bg-darker); border: 1px solid var(--border); }

.crop-stage:active { cursor: grabbing; }

.crop-zoom { display: flex; align-items: center; gap: 0.6rem; width: min(320px, 100%); color: var(--text-muted); }

.crop-zoom input { flex: 1; }

.crop-z-sm { width: 14px; height: 14px; }

.crop-z-lg { width: 22px; height: 22px; }

.crop-actions { display: flex; gap: 0.6rem; justify-content: flex-end; width: 100%; }

/* Etkinlik notu (odaya katildi / ayrildi / seviye): mesaj gibi degil, ince ve soluk tek satir */
.system-message.activity-note { font-style: normal; font-size: 0.72rem; opacity: 0.6; margin: 0.1rem 0; }

/* Yapilacaklar listesi: kimler isaretleyebilir */
.cl-access { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.4rem; font-size: 0.72rem; color: var(--text-muted); }
.cl-access .i { width: 12px; height: 12px; flex: none; }
.cl-access-editor { display: grid; gap: 0.45rem; margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--border); }
.cl-access-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; font-weight: 600; }
.cl-access-label .i { width: 14px; height: 14px; }
.cl-access-roles, .cl-access-users { display: grid; gap: 0.45rem; }
.cl-access-list { display: grid; gap: 0.15rem; max-height: 150px; overflow-y: auto; padding: 0.35rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-darker); }
.cl-access-list label { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.35rem; border-radius: var(--radius); font-size: 0.86rem; cursor: pointer; }
.cl-access-list label:hover { background: var(--bg-hover); }
.cl-access-list input[type=checkbox] { width: auto; flex: none; }
.cl-access-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Baglanti onizlemesi ---------- */
.lp-card {
    display: flex; gap: 0.7rem; align-items: stretch; margin-top: 0.4rem; max-width: 30rem; padding: 0.6rem 0.7rem;
    border: 1px solid var(--border); border-left: 4px solid var(--lp, var(--primary)); border-radius: var(--radius);
    background: var(--bg-dark); color: inherit; text-decoration: none; overflow: hidden;
    transition: background var(--d-fast, 0.12s), border-color var(--d-fast, 0.12s);
}
.lp-card:hover { background: var(--bg-panel); text-decoration: none; }
.lp-youtube { --lp: #ff0033; } .lp-x { --lp: #8b98a5; } .lp-instagram { --lp: #e1306c; }
.lp-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; flex: 1; }
.lp-site { display: flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; color: var(--text-muted); }
.lp-site .i { width: 15px; height: 15px; color: var(--lp, var(--text-muted)); flex: none; }
.lp-site b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-site i { font-style: normal; padding: 0 0.4rem; border: 1px solid var(--border); border-radius: 999px; flex: none; }
.lp-title { font-weight: 600; font-size: 0.92rem; line-height: 1.3; color: var(--text-main); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lp-author { font-size: 0.78rem; color: var(--text-muted); }
.lp-desc { font-size: 0.8rem; line-height: 1.4; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; white-space: pre-line; }
.lp-x .lp-desc { color: var(--text-main); -webkit-line-clamp: 6; font-size: 0.86rem; }
.lp-host { font-size: 0.68rem; color: var(--text-muted); opacity: 0.8; margin-top: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-thumb { position: relative; flex: none; width: 7.5rem; min-height: 4.6rem; align-self: stretch; background: var(--bg-darker); overflow: hidden; border-radius: calc(var(--radius) / 2); display: none; }
.lp-card.has-img .lp-thumb { display: block; }
.lp-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.lp-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(0,0,0,0.25); }
.lp-play .i { width: 28px; height: 28px; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.7)); }
/* Video: gorsel ustte, genis */
.lp-youtube { flex-direction: column; max-width: 24rem; }
.lp-youtube .lp-thumb { width: 100%; min-height: 0; aspect-ratio: 16 / 9; }
@media (max-width: 560px) { .lp-card { max-width: 100%; } .lp-thumb { width: 5.5rem; } }
