/* Discord'dan alınan kolaylıklar: açılır menüler ve profil kartı (menu.js), ipuçları (tips.js), hızlı geçiş (quick.js),
   @ önerileri, bahsetme vurgusu, "yazıyor…", "yeni mesajlar ↓", kısa bildirim. Temanın renkleriyle. */

/* ---------- Menü ---------- */
.cx-menu {
  position: fixed; z-index: 80; display: grid; gap: 1px; min-width: 220px; max-width: min(300px, calc(100vw - 16px));
  max-height: calc(100vh - 16px); overflow-y: auto; padding: 6px; outline: none;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 16px 40px -12px rgb(0 0 0 / 0.55);
}
.cx-menu[hidden] { display: none; }
.cx-menu.in { animation: cx-in 0.12s ease-out; }
@keyframes cx-in { from { opacity: 0; transform: translateY(-3px) scale(0.98); } }
.cx-head { display: flex; align-items: center; gap: 10px; padding: 6px 8px 8px; }
.cx-head .avatar { flex: none; width: 34px; height: 34px; font-size: 14px; }
.cx-head-text { display: grid; gap: 1px; min-width: 0; }
.cx-head b { color: var(--fg); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-head small { color: var(--muted); font-size: 11px; }
.avatar.cx-icon { display: grid; place-items: center; color: var(--muted); }
.avatar.cx-icon svg.i { width: 17px; height: 17px; }
.cx-sep { height: 1px; margin: 4px 6px; background: var(--line); }
.cx-note { padding: 4px 8px 6px; color: var(--faint); font-size: 11px; line-height: 1.45; }
.cx-item {
  display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 5px 8px; border-radius: 6px;
  color: var(--fg); font-size: 13px; text-align: left; cursor: pointer;
}
.cx-item:hover, .cx-item:focus-visible { background: var(--raise); outline: none; }
.cx-item:disabled { opacity: 0.45; cursor: default; }
.cx-item.danger { color: var(--err); }
.cx-item.danger:hover, .cx-item.danger:focus-visible { background: color-mix(in srgb, var(--err) 14%, transparent); }
.cx-lead { flex: none; display: grid; place-items: center; width: 18px; color: var(--muted); }
.cx-lead svg.i { width: 16px; height: 16px; }
.cx-lead img { width: 18px; height: 18px; }
.cx-item.danger .cx-lead { color: inherit; }
.cx-lead:empty { display: none; }
.cx-text { flex: 1; display: grid; min-width: 0; }
.cx-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-text small { color: var(--faint); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-hint { flex: none; margin-left: 8px; color: var(--faint); font-size: 10px; }
/* Onay kutusu (sağda) ve seçim noktası */
.cx-box, .cx-radio { flex: none; position: relative; width: 16px; height: 16px; margin-left: 6px; border: 1.5px solid var(--faint); }
.cx-box { border-radius: 4px; }
.cx-radio { border-radius: 50%; }
.cx-box.on { border-color: var(--accent); background: var(--accent); }
.cx-box.on::after {
  content: ""; position: absolute; left: 4.5px; top: 1px; width: 4px; height: 8px;
  border: solid var(--accent-fg); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.cx-radio.on { border-color: var(--accent); }
.cx-radio.on::after { content: ""; position: absolute; inset: 2.5px; border-radius: 50%; background: var(--accent); }
/* Kaydırıcı: dolu iz */
.cx-slider { display: grid; gap: 6px; padding: 6px 8px 8px; }
.cx-slider-top { display: flex; justify-content: space-between; color: var(--fg); font-size: 12px; }
.cx-slider-top small { color: var(--muted); font-variant-numeric: tabular-nums; }
.cx-slider input {
  --fill: 100%;
  width: 100%; height: 4px; margin: 6px 0; appearance: none; border-radius: 2px; cursor: pointer;
  background: linear-gradient(90deg, var(--accent) var(--fill), var(--line) var(--fill));
}
.cx-slider input::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--fg); box-shadow: 0 1px 4px rgb(0 0 0 / 0.4); }
.cx-slider input::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--fg); }

/* Kısa bildirim */
.cx-toast {
  position: fixed; left: 50%; bottom: 46px; z-index: 90; max-width: calc(100vw - 32px); padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg); font-size: 12px; box-shadow: 0 10px 30px -10px rgb(0 0 0 / 0.5);
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s;
}
.cx-toast.on { transform: translate(-50%, 0); opacity: 1; }

/* ---------- İpucu ---------- */
.tip {
  --arrow: 50%;
  position: fixed; z-index: 85; display: grid; gap: 3px; max-width: 260px; padding: 6px 10px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg); font-size: 12px; line-height: 1.35;
  box-shadow: 0 8px 22px -8px rgb(0 0 0 / 0.55); pointer-events: none; animation: tip-in 0.1s ease-out;
}
.tip[hidden] { display: none; }
@keyframes tip-in { from { opacity: 0; } }
.tip::after {
  content: ""; position: absolute; left: var(--arrow); bottom: -5px; width: 8px; height: 8px; margin-left: -4px;
  border: solid var(--line); border-width: 0 1px 1px 0; background: var(--panel); transform: rotate(45deg);
}
.tip.below::after { top: -5px; bottom: auto; border-width: 1px 0 0 1px; }
.tip > span:first-child { font-weight: 600; }
.tip-keys { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tip-keys kbd { min-width: 18px; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--raise); color: var(--fg); font-size: 10px; line-height: 16px; text-align: center; }
.tip-keys small, .tip-sub { color: var(--muted); font-size: 11px; }

/* ---------- Oda listesi: arama düğmesi, kişi satırı odağı ---------- */
.pane-title .pane-search {
  display: grid; place-items: center; width: 24px; height: 24px; margin-right: -6px; border-radius: 6px; color: var(--faint);
}
.pane-title .pane-search:hover { background: var(--raise); color: var(--fg); }
.pane-title .pane-search svg.i { width: 14px; height: 14px; }
.pane-title:has(.pane-search) b { margin-left: auto; }
.user-head { cursor: pointer; border-radius: 6px; }
.user-head:focus-visible { outline-offset: 0; }

/* ---------- Hızlı geçiş ---------- */
.qs {
  width: min(560px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 80px)); margin: 12vh auto auto; padding: 0;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--fg);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.7); overflow: hidden;
}
.qs::backdrop { background: rgb(0 0 0 / 0.55); }
.qs[open] { animation: qs-in 0.14s ease-out; }
@keyframes qs-in { from { opacity: 0; transform: translateY(-6px) scale(0.99); } }
.qs-box { display: flex; flex-direction: column; max-height: inherit; }
.qs-field { flex: none; display: flex; align-items: center; gap: 10px; margin: 12px 12px 6px; padding: 0 12px; height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--raise); }
.qs-field:focus-within { border-color: var(--accent); }
.qs-field svg.i { flex: none; width: 17px; height: 17px; color: var(--muted); }
.qs-field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--fg); font-size: 15px; }
.qs-field input:focus-visible { outline: none; } /* çerçeve kutunun kendisinde */
.qs-field input::placeholder { color: var(--faint); }
.qs-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 8px; }
.qs-group { padding: 10px 8px 4px; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.qs-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 6px 10px; border-radius: 8px; text-align: left; cursor: pointer; }
.qs-item.on { background: var(--raise); }
.qs-lead { flex: none; display: grid; place-items: center; width: 26px; height: 26px; color: var(--muted); }
.qs-lead svg.i { width: 17px; height: 17px; }
.qs-lead img { width: 22px; height: 22px; }
.qs-lead .avatar { width: 26px; height: 26px; font-size: 12px; }
.qs-text { flex: 1; display: grid; min-width: 0; }
.qs-text b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-text small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-item.on .qs-text b { color: var(--accent); }
.qs-tag { flex: none; color: var(--faint); font-size: 10px; font-style: normal; letter-spacing: 0.04em; }
.qs-empty { padding: 18px 10px; color: var(--muted); font-size: 12px; text-align: center; }
.qs-foot { display: flex; gap: 14px; padding: 8px 16px 10px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11px; }
.qs-foot kbd { margin-right: 2px; padding: 0 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--raise); color: var(--muted); font-size: 10px; }
/* Hızlı geçişle açılan oyun kartı bir an parlar */
.qs-flash { animation: qs-flash 1.3s ease-out; }
@keyframes qs-flash { 0%, 40% { box-shadow: 0 0 0 2px var(--accent); } 100% { box-shadow: 0 0 0 2px transparent; } }

/* ---------- Sohbet: @ önerileri, bahsetme, yazıyor, yeni mesajlar ---------- */
.composer { position: relative; }
.at-pop {
  position: absolute; left: -1px; right: -1px; bottom: calc(100% + 6px); z-index: 20; display: grid; gap: 1px; padding: 6px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 -10px 30px -12px rgb(0 0 0 / 0.5);
}
.at-pop[hidden] { display: none; }
.at-item { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 4px 8px; border-radius: 6px; text-align: left; cursor: pointer; }
.at-item.on { background: var(--raise); }
.at-item .avatar { width: 24px; height: 24px; font-size: 11px; }
.at-item b { font-size: 13px; }
.at-item small { margin-left: auto; color: var(--faint); font-size: 11px; }
.msg .at { padding: 0 3px; border-radius: 4px; background: color-mix(in srgb, var(--n2) 16%, transparent); color: var(--n2); font-weight: 600; }
.msg .at.me { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
/* Senden bahseden mesaj (Discord'daki gibi): solda çizgi, hafif zemin */
.msg.mention { margin-left: -16px; padding-left: 13px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.chat-typing {
  flex: none; display: flex; align-items: center; gap: 6px; height: 0; margin: 0 16px; overflow: hidden;
  color: var(--muted); font-size: 11px; transition: height 0.15s;
}
.chat-typing.on { height: 20px; }
.chat-typing b { color: var(--fg); font-weight: 600; }
.chat-dots { display: inline-flex; gap: 3px; }
.chat-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); animation: dot 1.1s ease-in-out infinite; }
.chat-dots i:nth-child(2) { animation-delay: 0.15s; }
.chat-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.p-chat { position: relative; }
/* 5.81: mesajların ortasında (sağdaki özel mesaj sütunu --dm hariç); "translate" ile, açılış animasyonu (transform) kaydırmasın */
.chat-jump {
  position: absolute; left: calc((100% - var(--dm, 0px)) / 2); bottom: 66px; z-index: 5; padding: 5px 12px; border-radius: 999px; translate: -50% 0;
  background: var(--accent); color: var(--accent-fg); font-size: 12px; font-weight: 700; box-shadow: 0 8px 20px -8px rgb(0 0 0 / 0.5);
  animation: in 0.15s ease-out;
}
.chat-jump[hidden] { display: none; }
/* Telefonda: sohbet sekmesinde bahsetme rozeti; kısa bildirim alttaki sekmelerin (56 px) üstünde */
@media (max-width: 760px) {
  .cx-toast { bottom: calc(56px + 12px); }
  .tabs button.mention::after { content: "@"; width: 14px; height: 14px; left: calc(50% + 8px); top: 6px; display: grid; place-items: center; background: var(--err); color: #fff; font-size: 9px; font-weight: 800; line-height: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .cx-menu.in, .tip, .qs[open], .chat-dots i, .qs-flash, .chat-jump { animation: none; }
}
