/* Keyfi 101 — sohbet paneli ve açılır pencereler */

/* ————————————————————————————————————————— sohbet */

/* Sağ üstteki kutu, menünün koyu panel diliyle. Başlıkta simge, SOHBET
   etiketi ve son satır; kapalıyken gelen yeni satırlar altın rozette
   sayılır. Başlığa tıklayınca geçmiş aşağı açılır. Yazma satırı hep açık. */
.chat {
  position: relative;
  width: 440px;
  background: linear-gradient(180deg, #191d25 0%, #12161d 100%);
  border: 1px solid var(--panel-line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  z-index: 35;
  transition: border-color .15s;
}
.chat.open, .chat:focus-within { border-color: rgba(215, 165, 63, .38); }

.chat-head {
  width: 100%; height: 50px;
  display: flex; align-items: center; gap: 11px;
  padding: 0 12px 0 10px;
  background: none; border: 0;
  text-align: left;
}
.chat-ikon {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  color: var(--gold-hi);
  background: rgba(215, 165, 63, .1);
  border: 1px solid rgba(215, 165, 63, .3);
  border-radius: 50%;
}
.chat-ikon svg { width: 17px; height: 17px; }
.chat-yazi { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chat-yazi b { font-size: 10px; font-weight: 800; letter-spacing: 1.5px; color: var(--gold-hi); }
.chat-last {
  font-size: 13px; color: var(--txt-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-rozet {
  min-width: 22px; height: 22px; padding: 0 7px; flex: none;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #2a1c00;
  background: linear-gradient(180deg, #f0c063 0%, var(--gold) 55%, #b4821f 100%);
  border-radius: 999px;
}
.chat-rozet[hidden] { display: none; }
.chat-head .chev { width: 18px; height: 18px; flex: none; opacity: .6; transition: transform .2s; }
.chat-head:hover .chev { opacity: 1; }
.chat.open .chat-head .chev { transform: rotate(180deg); }

.chat-log {
  max-height: 0;
  overflow-y: auto;
  padding: 0 14px;
  border-top: 1px solid transparent;
  transition: max-height .25s ease, padding .25s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(215, 165, 63, .4) transparent;
}
.chat.open .chat-log {
  max-height: 260px;
  padding: 12px 14px;
  border-top-color: var(--panel-line);
}

/* Sohbette yalnızca dört olay ve senin yazdıkların görünür. */
.msg { margin: 0 0 7px; font-size: 13px; line-height: 1.45; color: var(--txt-dim); }
.msg b { color: var(--gold); font-weight: 700; }
/* Tur başlangıcı: iki yanı çizgili, ortada altın başlık. */
.msg.round-start {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0 9px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px; color: var(--gold-hi);
  text-align: center;
}
.msg.round-start::before, .msg.round-start::after {
  content: ""; flex: 1; min-width: 14px; height: 1px; background: rgba(215, 165, 63, .25);
}
.msg.round-start:first-child { margin-top: 0; }
.msg.finish { color: var(--green-hi); font-weight: 600; }
.msg.penalty { color: #e88a82; }
.msg.round-end { margin-bottom: 10px; color: var(--gold-hi); font-weight: 600; }
/* Başka oyuncunun yazdığı: adı altın, balonun köşesi öbür yanda. */
.msg.sohbet {
  padding: 6px 10px;
  color: var(--txt);
  background: rgba(215, 165, 63, .06);
  border: 1px solid rgba(215, 165, 63, .2);
  border-radius: 10px 10px 3px 10px;
}
.msg.sohbet b { color: var(--gold-hi); }
/* Senin yazdığın: hafif bir balon. */
.msg.me {
  padding: 6px 10px;
  color: var(--txt);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--panel-line);
  border-radius: 10px 10px 10px 3px;
}
.msg.me b { color: #8cc4f0; }

.chat-input {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px 10px;
}
.chat-alan {
  flex: 1; min-width: 0; height: 40px;
  display: flex; align-items: center; gap: 2px;
  padding: 0 4px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  transition: border-color .15s;
}
.chat-alan:focus-within { border-color: rgba(215, 165, 63, .5); }
.chat-alan input {
  flex: 1; min-width: 0; height: 100%;
  padding: 0 10px 0 4px;
  background: none; border: 0;
  color: var(--txt); font-size: 14px;
}
.chat-alan input::placeholder { color: var(--txt-mute); }
.chat-alan input:focus { outline: none; }
.emoji-btn {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: 50%;
  color: var(--txt-mute);
}
.emoji-btn svg { width: 19px; height: 19px; }
.emoji-btn:hover { color: var(--gold-hi); background: rgba(255, 255, 255, .06); }
/* Gönder: temanın dolu altın düğmesi. */
.send-btn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  color: #2a1c00;
  background: linear-gradient(180deg, #f0c063 0%, var(--gold) 55%, #b4821f 100%);
  border: 1px solid #6f5014; border-radius: 50%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: filter .15s, transform .12s;
}
.send-btn svg { width: 18px; height: 18px; margin-left: -1px; stroke-width: 1.9; }
.send-btn:hover { filter: brightness(1.08); }
.send-btn:active { transform: translateY(1px); }

.emoji-bar {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px;
  padding: 10px;
  border-top: 1px solid var(--panel-line);
}
.emoji-bar button {
  height: 34px;
  background: rgba(255, 255, 255, .045); border: 1px solid transparent; border-radius: 8px;
  font-size: 18px; line-height: 1;
  transition: background .12s, border-color .12s;
}
.emoji-bar button:hover { background: rgba(215, 165, 63, .12); border-color: rgba(215, 165, 63, .35); }

/* ————————————————————————————————————— açılır pencereler */

.modal-layer {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(4, 6, 9, .72);
  backdrop-filter: blur(3px);
  z-index: 80;
}
.modal-layer[hidden] { display: none; }

.modal {
  width: 560px; max-height: 720px;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #1b1f27, #12151b);
  border: 1px solid rgba(215, 165, 63, .28);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  animation: modal-in .22s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--panel-line);
}
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: .2px; }
.modal-head .sub { display: block; margin-top: 4px; font-size: 13px; color: var(--txt-mute); font-weight: 400; }
.modal-x {
  width: 32px; height: 32px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .06); border: 0; border-radius: 8px; color: var(--txt-dim);
}
.modal-x svg { width: 16px; height: 16px; }
.modal-x:hover { background: var(--red); color: #fff; }

.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--panel-line);
}

/* puan tablosu */
.score-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.score-table th {
  padding: 8px 10px; text-align: left;
  font-size: 12px; font-weight: 600; color: var(--txt-mute);
  letter-spacing: .6px; text-transform: uppercase;
  border-bottom: 1px solid var(--panel-line);
}
.score-table td { padding: 11px 10px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.score-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.score-table tr.me td { color: var(--gold-hi); font-weight: 600; }
.score-table tr.lead td:first-child::before { content: "★ "; color: var(--gold); }
.delta-plus { color: #e88a82; }
.delta-minus { color: var(--green-hi); }
.tag {
  display: inline-block; margin-left: 8px; padding: 2px 8px;
  border-radius: 99px; font-size: 11px; font-weight: 700;
  background: rgba(255, 255, 255, .08); color: var(--txt-mute);
}
.tag.ok { background: rgba(47, 158, 87, .22); color: var(--green-hi); }

/* ayar satırları */
.field { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.field:last-child { border-bottom: 0; }
.field label { font-size: 15px; }
.field .hint { display: block; margin-top: 3px; font-size: 12px; color: var(--txt-mute); }
.seg { display: flex; gap: 4px; background: rgba(255, 255, 255, .05); padding: 3px; border-radius: 9px; }
.seg button {
  padding: 7px 14px; background: none; border: 0; border-radius: 7px;
  font-size: 13px; font-weight: 600; color: var(--txt-mute);
}
.seg button.on { background: rgba(215, 165, 63, .9); color: #241900; }

.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: 99px;
  background: rgba(255, 255, 255, .13); transition: background .2s;
  pointer-events: none;
}
.switch span::after {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #cfd3da; transition: transform .2s;
}
.switch input:checked + span { background: rgba(47, 158, 87, .85); }
.switch input:checked + span::after { transform: translateX(20px); background: #fff; }

/* kurallar listesi */
.rules-list { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.7; color: var(--txt-dim); }
.rules-list li { margin-bottom: 6px; }
.rules-list b { color: var(--txt); }

.win-banner {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; padding: 14px 16px;
  background: rgba(47, 158, 87, .14);
  border: 1px solid rgba(71, 193, 115, .35);
  border-radius: var(--r-md);
  font-size: 16px; font-weight: 600; color: var(--green-hi);
}
.win-banner.lose { background: rgba(196, 54, 46, .12); border-color: rgba(196, 54, 46, .35); color: #eb9089; }
.win-banner.draw { background: rgba(255, 255, 255, .05); border-color: var(--panel-line); color: var(--txt-dim); }

/* Onay penceresindeki düz metin (çıkış gibi soru kutuları). */
.modal-text {
  margin: 0;
  font-size: 15px; line-height: 1.6; color: var(--txt-dim);
}


/* ————————————————————————————————— masa açma penceresi */

/* Ayrı sayfa değil: lobinin üstünde, arkası karartılmış bir pencere. Köşede
   sıcak bir parıltı, alanlar koyu kutular, altta iki eşit düğme. */
.modal.ma-pencere {
  width: 620px;
  background:
    radial-gradient(55% 60% at 100% 100%, rgba(226, 150, 22, .2), transparent 72%),
    linear-gradient(180deg, #1d2027, #121419);
  border-color: rgba(255, 255, 255, .1);
}
.ma-pencere .modal-head { align-items: flex-start; padding: 26px 30px 4px; border-bottom: 0; }
.ma-pencere .modal-head h2 { font-size: 24px; font-weight: 600; }
.ma-pencere .modal-head .sub { margin-top: 12px; font-size: 14px; line-height: 1.6; color: var(--txt-dim); }
/* Açılır liste gövdenin dışına taşabilsin diye gövde kırpmıyor. */
.ma-pencere .modal-body { padding: 18px 30px 4px; overflow: visible; }
.ma-pencere .modal-foot {
  display: grid; grid-template-columns: 1fr 1fr; gap: 22px;
  padding: 22px 30px 28px;
  border-top: 0;
}

.ma-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 16px; }
/* Kural: hızlı oyundaki katlamasız / katlamalı anahtarı (.ho-kurallar,
   css/menu.css), formun tam eninde. */
.ma-kural { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.ma-kural > span { font-size: 10px; font-weight: 700; letter-spacing: .7px; color: var(--txt-mute); }
/* Pencerede anahtar öteki alanlarla (.ma-alan) aynı zeminde. */
.ma-kural .ho-kurallar { height: 52px; background: rgba(255, 255, 255, .07); border-color: transparent; border-radius: 6px; box-shadow: none; }
/* Ucret: rakam ve yaninda oyunun jetonu. */
.ma-ucret { display: inline-flex; align-items: center; gap: 7px; }
.ma-ucret .coin { width: 18px; height: 18px; }
.ma-alan {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  height: 52px; padding: 0 14px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}
.ma-alan:focus-within { border-color: rgba(242, 208, 137, .55); }
.ma-alan.ma-genis { grid-column: 1 / -1; cursor: text; }
.ma-alan > span { font-size: 10px; font-weight: 700; letter-spacing: .7px; color: var(--txt-mute); }
.ma-alan input {
  width: 100%; margin: 0; padding: 0;
  font: inherit; font-size: 15px; font-weight: 500; color: var(--txt);
  background: none; border: 0; outline: none;
}
.ma-alan input::placeholder { color: var(--txt-mute); }

/* ——— açılır liste: tarayıcının beyaz listesi yerine temaya uyan liste */
.ma-secim-dugme {
  width: 100%; margin: 0; padding: 0 22px 0 0;
  font: inherit; font-size: 15px; font-weight: 500; color: var(--txt);
  text-align: left;
  background: none; border: 0; outline: none;
}
.ma-secim:hover { background: rgba(255, 255, 255, .1); }
.ma-secim.is-acik { border-color: rgba(242, 208, 137, .55); background: rgba(255, 255, 255, .1); }
/* ok: açıkken yukarı döner */
.ma-secim::after {
  content: "";
  position: absolute; right: 16px; top: 50%;
  width: 7px; height: 7px;
  border-right: 2px solid var(--txt-dim);
  border-bottom: 2px solid var(--txt-dim);
  transform: translateY(-20%) rotate(45deg);
  transition: transform .15s;
  pointer-events: none;
}
.ma-secim.is-acik::after { transform: translateY(20%) rotate(-135deg); border-color: var(--gold-hi); }

.ma-liste {
  position: absolute; left: -1px; right: -1px; top: calc(100% + 6px);
  margin: 0; padding: 6px;
  max-height: 264px; overflow-y: auto;
  list-style: none;
  background: linear-gradient(180deg, #20242c, #171a20);
  border: 1px solid rgba(215, 165, 63, .35);
  border-radius: 8px;
  box-shadow: var(--shadow-2);
  z-index: 5;
  scrollbar-width: thin;
  animation: modal-in .14s ease-out;
}
.ma-liste[hidden] { display: none; }
.ma-liste li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  font-size: 14px; font-weight: 500; color: var(--txt-dim);
  border-radius: 6px;
  cursor: pointer;
}
.ma-liste li:hover { color: var(--txt); background: rgba(255, 255, 255, .06); }
.ma-liste li[aria-selected="true"] { color: var(--gold-hi); font-weight: 700; background: rgba(215, 165, 63, .14); }
.ma-liste li[aria-selected="true"]::after { content: "✓"; font-size: 13px; }
/* Kapalı seçenek (ör. bakiyenin yetmediği ücret): görünür, seçilemez. */
.ma-liste li.is-kapali { opacity: .35; cursor: not-allowed; }
.ma-liste li.is-kapali:hover { color: var(--txt-dim); background: none; }
.ma-kasa { margin: 16px 0 0; font-size: 13px; color: var(--txt-dim); }
.ma-kasa b { color: var(--gold-hi); }
.ma-kasa em { font-style: normal; color: #ff9a90; }

.ma-iptal, .ma-ac { height: 48px; font-size: 14px; font-weight: 700; border-radius: 5px; }
.ma-iptal {
  color: var(--txt);
  background: linear-gradient(180deg, #2b2e35, #1d1f24);
  border-color: rgba(255, 255, 255, .12);
}
.ma-ac {
  color: #1f1400;
  background: linear-gradient(180deg, #ffb72f, #f29a0c);
  border-color: #c77a06;
}

/* ————————————————————————————————— davet penceresi */

.modal.dv-pencere { width: 560px; }
.dv-link { margin-top: 10px; }
.dv-link-yazi { width: 100%; }
.dv-bot {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: rgba(215, 165, 63, .07);
  border: 1px solid rgba(215, 165, 63, .25);
  border-radius: var(--r-md);
}
.dv-bot-ikon {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  color: var(--gold);
  background: rgba(255, 255, 255, .07);
  border-radius: 50%;
}
.dv-bot-ikon svg { width: 22px; height: 22px; }
.dv-bot-yazi { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dv-bot-yazi b { font-size: 15px; }
.dv-bot-yazi i { font-style: normal; font-size: 12px; color: var(--txt-mute); }
.dv-bot-btn, .dv-davet {
  height: 34px; padding: 0 16px;
  font-size: 13px; font-weight: 700;
  color: #2a1c00;
  background: linear-gradient(180deg, #f0c063, var(--gold));
  border-color: #8a6416;
  border-radius: 8px;
}
.dv-davet.is-gitti:disabled {
  opacity: 1; filter: none;
  color: var(--green-hi);
  background: rgba(47, 158, 87, .14);
  border-color: rgba(71, 193, 115, .35);
}

.dv-arkadaslar { margin-top: 18px; max-height: 380px; overflow-y: auto; scrollbar-width: thin; }
.dv-baslik { margin: 16px 0 8px; font-size: 11px; font-weight: 800; letter-spacing: .8px; color: var(--txt-mute); }
.dv-baslik:first-child { margin-top: 0; }
.dv-baslik em { margin-left: 4px; font-style: normal; color: var(--gold); }
.dv-liste { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.dv-kisi {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--panel-line);
  border-radius: 10px;
}
.dv-kisi .ark-avatar { position: relative; width: 36px; height: 36px; font-size: 15px; }
.dv-kisi:not(.is-online) .ark-avatar { filter: grayscale(.9) brightness(.65); }
.dv-kisi.is-online .ark-avatar::after {
  content: "";
  position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px;
  background: var(--green-hi);
  border: 2px solid #161a21;
  border-radius: 50%;
}
.dv-ad { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.dv-ad b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-ad b i { margin-left: 2px; font-style: normal; font-weight: 500; color: var(--txt-mute); }
.dv-ad span { font-size: 12px; color: var(--txt-mute); }
.dv-kisi.is-online .dv-ad span { color: var(--green-hi); }
.dv-durum { font-size: 12px; font-weight: 700; color: var(--txt-mute); }
.dv-bos { margin: 4px 0; font-size: 14px; line-height: 1.5; color: var(--txt-mute); }

/* ————————————————————————————————— gelen davet kartları */

/* Menünün de masanın da üstünde, pencere katmanının altında durur. */
.davet-kutusu {
  position: absolute; left: 50%; top: 70px;
  width: 640px; margin-left: -320px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 78;
}
.davet-kutusu[hidden] { display: none; }
.davet-kart {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(36, 31, 20, .97), rgba(20, 18, 13, .97));
  border: 1px solid rgba(215, 165, 63, .55);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2), 0 0 30px rgba(215, 165, 63, .16);
  animation: modal-in .25s ease-out;
}
.dk-ikon {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  color: var(--gold-hi);
  background: rgba(215, 165, 63, .14);
  border-radius: 50%;
}
.dk-ikon svg { width: 20px; height: 20px; }
.dk-govde { flex: 1; min-width: 0; font-size: 15px; line-height: 1.35; color: var(--txt); }
.dk-govde b { color: var(--gold-hi); }
.dk-govde span {
  display: block; margin-top: 2px;
  font-size: 12px; color: var(--txt-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dk-red, .dk-katil { height: 36px; padding: 0 16px; font-size: 13px; font-weight: 700; border-radius: 8px; }
.dk-red { color: var(--txt-dim); background: rgba(255, 255, 255, .06); border-color: var(--panel-line); }
.dk-katil { color: #1f1400; background: linear-gradient(180deg, #ffb72f, #f29a0c); border-color: #c77a06; }
