/* Sesliye Gel uygulamasi (klan sayfasi). Ortak dil temel.css'te (once
   yuklenir): renkler, yazi, dugme, alan, kart, giris ekrani. Burada
   uygulamanin duzeni ve bilesenleri.
   Renk anlami: amber (--signal = --sinyal) YALNIZCA konusma/ses seviyesi.
   Secili oda, rozetler, birincil dugmeler kemik beyazi. */

/* Eski degisken adlari yeni dile bagli: JS ve bilesenler bunlari kullaniyor. */
:root {
  --field: var(--zemin);
  --well: var(--zemin-derin);
  --plate: var(--yuzey);
  --line: var(--kart-kenar);
  --bone: var(--metin);
  --mist: var(--ikincil);
  --signal: var(--sinyal);
  --alarm: var(--hata);
  --ink: var(--lacivert);
  --ok: var(--iyi);
}

html, body { height: 100%; }
body { overscroll-behavior: none; }
hr { border: none; border-top: 1px solid var(--cizgi); margin: 1rem 0 .5rem; }
button svg { width: 1.25rem; height: 1.25rem; flex: none; }
button.primary:disabled { opacity: .55; cursor: progress; }
button.icon-btn { min-height: 2.25rem; min-width: 2.25rem; padding: .35rem; background: transparent; border-color: transparent; }
button.icon-btn:hover { background: var(--yuzey); }
label { display: block; }

/* ============ GIRIS ============ */
/* Duzen temel.css'te (.gate). Uygulamaya ozel: formlar arasi ikinci dugme. */
.gate-form button + button { margin-top: 0; }

/* ============ YERLESIM ============ */
/* Masaustu: solda tam boy kenar cubugu; sagda sahne, altinda kontrol cubugu.
   Sohbet acikken en sagda bir sutun daha. */

.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "sidebar stage" "sidebar deck";
}

/* --- kenar cubugu: klan ve odalar --- */

.sidebar {
  grid-area: sidebar;
  display: flex; flex-direction: column; gap: .75rem; min-height: 0;
  background: var(--zemin-derin);
  border-right: 1px solid var(--cizgi);
  padding: 1.1rem .75rem .75rem;
}
.channel { display: flex; align-items: flex-start; gap: .25rem; flex-wrap: wrap; padding: 0 .4rem; }
/* Sistemin adi klan adinin ustunde, kucuk ve sakin. */
.system-name { flex: 1 0 100%; font-size: .875rem; color: var(--ikincil); margin-bottom: .35rem; }
.system-name .isaret-cubuklar { height: .95rem; }
.channel h1 {
  flex: 1; min-width: 0;
  font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1;
  overflow-wrap: anywhere;
}
.room-list { flex: 1 1 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .15rem; }

.room-item { border-radius: var(--kose-kucuk); position: relative; }
.room-row {
  width: 100%; display: flex; align-items: center; gap: .5rem;
  min-height: 2.5rem; padding: .3rem .6rem;
  background: transparent; border: none; border-radius: var(--kose-kucuk);
  color: var(--ikincil); font-weight: 600; font-size: .9375rem; text-align: left; cursor: pointer;
}
.room-row:hover { background: var(--yuzey); color: var(--metin); }
/* Bulundugun oda: kemik beyazi yazi ve soldaki isaret (amber degil). */
.room-item.is-here { background: var(--yuzey); }
.room-item.is-here .room-row { color: var(--metin); font-weight: 700; }
.room-item.is-here::before {
  content: ""; position: absolute; left: 0; top: .6rem; height: 1.3rem;
  width: 3px; border-radius: 2px; background: var(--metin);
}
.room-row .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-row .count { color: var(--soluk); font-size: .8125rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.room-row svg { width: .95rem; height: .95rem; color: var(--ikincil); }
.room-row:disabled { opacity: .45; cursor: not-allowed; }

.room-who { list-style: none; margin: 0; padding: 0 .6rem .45rem 1.35rem; display: flex; flex-direction: column; gap: .15rem; }
.room-who li { display: flex; align-items: center; gap: .4rem; font-size: .8125rem; color: var(--ikincil); min-height: 1.5rem; }
/* icon() boyutsuz bir <svg> uretiyor; kural olmayinca tarayici varsayilani
   devasa cikiyordu. Metinle ayni boy olmali. */
.room-who li svg { width: 1em; height: 1em; flex: none; opacity: .85; }
.room-who li.talking { color: var(--sinyal); font-weight: 600; }
.room-who .dot { width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; flex: none; }
.room-who .tag { font-size: .6875rem; text-transform: uppercase; letter-spacing: .04em; color: var(--soluk); }
.room-who li.talking .tag { color: inherit; }
.room-who .who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-who li[draggable="true"] { cursor: grab; }
.room-who li[draggable="true"]:active { cursor: grabbing; }

/* Baska odaya tasima kutusu: dar, yalnizca bir ok gorunur */
.move-sel {
  width: 1.6rem; min-height: 1.3rem; margin-left: auto; padding: 0 0 0 .15rem;
  flex: none; font-size: .6875rem; line-height: 1;
  background: transparent; border: 1px solid transparent; border-radius: 3px;
  color: var(--ikincil); cursor: pointer; appearance: none; text-align: center;
}
.move-sel:hover, .move-sel:focus-visible { background: var(--yuzey); border-color: var(--kart-kenar); color: var(--metin); }

/* Surukleyip birakma hedefi */
.room-item.is-drop { background: var(--yuzey-2); outline: 2px dashed var(--metin); outline-offset: -2px; }

.side-foot { display: flex; flex-direction: column; gap: .1rem; border-top: 1px solid var(--cizgi); padding-top: .6rem; }
.side-link {
  min-height: 2.5rem; justify-content: flex-start; padding: 0 .6rem;
  background: transparent; border-color: transparent; color: var(--ikincil); font-size: .9375rem;
}
.side-link:hover { background: var(--yuzey); color: var(--metin); }
.me { display: flex; align-items: center; gap: .5rem; padding: .6rem .6rem 0; margin-top: .3rem; border-top: 1px solid var(--cizgi); font-weight: 700; }
.me #me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Rol rozeti: yazili, renk tek basina anlam tasimiyor. */
.role {
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  color: var(--ikincil); border: 1px solid var(--kart-kenar); border-radius: 999px; padding: .05rem .45rem;
  white-space: nowrap;
}
.role.admin { color: var(--lacivert); background: var(--metin); border-color: var(--metin); }
.role.mod { color: var(--metin); border-color: var(--kenar); }

/* --- sahne --- */

.stage {
  grid-area: stage;
  display: flex; flex-direction: column; gap: .9rem; min-height: 0; min-width: 0;
  padding: 1.25rem 1.5rem .75rem;
}
.stage-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .9rem; }
.stage-head h2 { font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 800; letter-spacing: -.03em; line-height: 1; overflow-wrap: anywhere; }
.stage-status { color: var(--ikincil); }
.only-narrow { display: none; }

.stage-hint {
  padding: .6rem .85rem; max-width: 70ch;
  border-left: 3px solid var(--metin); background: var(--yuzey); border-radius: 0 var(--kose-kucuk) var(--kose-kucuk) 0;
}
.stage-hint.bad { border-color: var(--hata); }

/* ekran paylasimi: secili yayin ustte buyur, digerleri altta minikuk */
.share-stage { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: .5rem; }

.share-main {
  position: relative; flex: 1 1 0; min-height: 0; margin: 0;
  background: #000; border: 1px solid var(--kart-kenar); border-radius: var(--kose); overflow: hidden;
}
.share-main-slot { position: absolute; inset: 0; }
.share-main-slot video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.share-main figcaption {
  position: absolute; left: 0; bottom: 0; z-index: 2;
  padding: .3rem .7rem; font-size: .875rem; font-weight: 700;
  background: rgba(10, 22, 34, .85); border-top-right-radius: var(--kose-kucuk);
}
/* Tam ekran dugmesi buyutulmus yayinin sag altinda */
.share-full {
  position: absolute; right: .6rem; bottom: .6rem; z-index: 2;
  min-height: 2.25rem; padding: .3rem .7rem; font-size: .8125rem;
  background: rgba(10, 22, 34, .85); border-color: var(--kart-kenar);
}
.share-full:hover { background: var(--yuzey); }
.share-main:fullscreen { border: none; border-radius: 0; }
.share-main:fullscreen .share-full { right: 1rem; bottom: 1rem; }

/* Minikukler: ikinci ve sonraki yayinlar */
.share-strip { flex: 0 0 auto; display: flex; gap: .5rem; overflow-x: auto; }
.share-strip:empty { display: none; }
.share-thumb {
  position: relative; flex: 0 0 auto; width: 9rem; height: 5.1rem; padding: 0;
  background: #000; border: 2px solid var(--kart-kenar); border-radius: var(--kose-kucuk);
  overflow: hidden; cursor: pointer;
}
.share-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.share-thumb span {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: .1rem .35rem; font-size: .6875rem; font-weight: 700;
  background: rgba(10, 22, 34, .85); text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.share-thumb.is-active { border-color: var(--metin); }
.share-thumb:hover { border-color: var(--ikincil); }

/* --- kisi sutunlari --- */

.mixer { flex: 0 1 auto; display: flex; gap: .75rem; min-height: 0; overflow-x: auto; padding: 2px; }

/* Paylasim varken kisiler kaybolmuyor: sutunlar yatay/kompakt bicime
   geciyor, ad + ses seviyesi + sustur erisilebilir kaliyor. */
.app.has-share .mixer { flex: 0 0 auto; max-height: 9.5rem; overflow-y: auto; }
.app.has-share .strip { flex: 0 0 15rem; flex-direction: row; max-width: none; min-width: 0; }
.app.has-share .well { flex: 0 0 3.6rem; min-height: 3.6rem; }
.app.has-share .initial {
  left: 0; right: 0; bottom: auto; top: 50%; transform: translateY(-50%);
  text-align: center; font-size: 1.6rem;
}
.app.has-share .badge { top: .15rem; right: .15rem; width: 1.2rem; height: 1.2rem; padding: .18rem; }
.app.has-share .sharing-badge { top: .15rem; left: .15rem; width: 1.1rem; height: 1.1rem; padding: .16rem; }
.app.has-share .plate { flex: 1; min-width: 0; padding: .35rem .5rem; gap: .1rem; }
.app.has-share .who { font-size: .9375rem; }
.app.has-share .state { font-size: .75rem; }
.app.has-share .dial { font-size: .75rem; }
.app.has-share .dial input { min-height: 1.25rem; }
.app.has-share .chip { min-height: 1.75rem; padding: .1rem .45rem; font-size: .75rem; }

.strip {
  flex: 1 1 0; min-width: 11rem; max-width: 17rem;
  display: flex; flex-direction: column;
  background: var(--yuzey); border: 1px solid var(--kart-kenar); border-radius: var(--kose); overflow: hidden;
}
/* Konusan: amber halka (renk tek basina degil: adi da amber, seviye dolar). */
.strip.is-speaking { border-color: var(--sinyal); box-shadow: 0 0 0 1px var(--sinyal); }
.well { position: relative; flex: 1 1 auto; min-height: 7.5rem; background: var(--zemin-derin); overflow: hidden; isolation: isolate; }
.fill { position: absolute; inset: 0; background: var(--sinyal); clip-path: inset(100% 0 0 0); }
.initial {
  position: absolute; left: .8rem; bottom: .3rem;
  font-family: var(--yazi-baslik);
  font-size: clamp(3.5rem, 11vh, 7rem); font-weight: 800; line-height: 1;
  color: var(--metin); pointer-events: none;
}
.fill .initial { color: var(--lacivert); }
.threshold { position: absolute; left: 0; right: 0; height: 2px; background: repeating-linear-gradient(90deg, var(--metin) 0 8px, transparent 8px 16px); opacity: .8; }
.badge {
  position: absolute; top: .6rem; right: .6rem;
  width: 2.1rem; height: 2.1rem; padding: .4rem;
  background: var(--hata); color: var(--lacivert); border-radius: 50%; display: none;
}
.strip.is-closed .badge { display: block; }
.strip.is-closed .well { background: repeating-linear-gradient(135deg, var(--zemin-derin) 0 12px, #0f1e2e 12px 24px); }
.sharing-badge {
  position: absolute; top: .6rem; left: .6rem;
  width: 1.9rem; height: 1.9rem; padding: .35rem;
  background: var(--iyi); color: var(--lacivert); border-radius: 50%; display: none;
}
.strip.is-sharing .sharing-badge { display: block; }

.plate { padding: .65rem .75rem .75rem; display: flex; flex-direction: column; gap: .4rem; }
.plate-top { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.who { font-family: var(--yazi-baslik); font-size: 1.1875rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.strip.is-speaking .who { color: var(--sinyal); }
.state { color: var(--ikincil); font-size: .8125rem; min-height: 1.25em; }
.state.bad { color: var(--hata); font-weight: 600; }
.plate-row { display: flex; flex-direction: column; gap: .4rem; }
.dial { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .15rem .5rem; font-size: .8125rem; font-weight: 500; color: var(--ikincil); }
.dial input { grid-column: 1 / -1; }
.dial output { color: var(--ikincil); font-variant-numeric: tabular-nums; }
.no-mic .dial, .no-mic .threshold { display: none; }
.chip { min-height: 2.25rem; padding: .25rem .65rem; font-size: .8125rem; border-radius: 999px; }
.chip[aria-pressed="true"] { background: var(--hata); border-color: var(--hata); color: var(--lacivert); }
.strip-tools { display: flex; gap: .35rem; }

.alone { flex: 1 1 14rem; max-width: 26rem; align-self: center; padding: 1rem; color: var(--ikincil); font-size: 1.0625rem; }

/* --- alt cubuk --- */

.deck {
  grid-area: deck;
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch;
  padding: .75rem 1.5rem 1rem;
  border-top: 1px solid var(--cizgi);
}
.deck button { min-height: 3rem; background: var(--yuzey); border-color: var(--kart-kenar); }
.deck button:hover { background: var(--yuzey-2); }
.deck .mic { flex: 0 1 13rem; min-height: 3rem; font-size: 1.0625rem; background: var(--metin); border-color: var(--metin); color: var(--lacivert); }
.deck .mic:hover { background: #fff; }
.deck .mic[aria-pressed="true"] { background: var(--hata); border-color: var(--hata); color: var(--lacivert); }
.deck .mic:disabled { background: var(--yuzey); border-color: var(--kart-kenar); color: var(--ikincil); cursor: default; }
#btn-deaf[aria-pressed="true"] { background: var(--hata); border-color: var(--hata); color: var(--lacivert); }
#btn-share[aria-pressed="true"] { background: var(--iyi); border-color: var(--iyi); color: var(--lacivert); }
#btn-chat[aria-pressed="true"] { background: var(--yuzey-2); border-color: var(--metin); }
.deck .leave { margin-left: auto; background: transparent; color: var(--hata); border-color: rgba(255, 138, 128, .45); }
.deck button { padding: 0 .85rem; font-size: .9375rem; }
.deck .deck-icon { width: 3rem; padding: 0; flex: 0 0 auto; }
.gizli-ad { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Alt cubuk dar kalinca (sohbet acik, kucuk pencere) ikincil dugmeler
   yalnizca simge olur; yazi ekran okuyucuya acik kalir. */
.deck { container-type: inline-size; }
@container (max-width: 46rem) {
  .deck button:not(.mic):not(.leave) { width: auto; min-width: 3rem; max-width: 4.5rem; padding: 0; flex: 1 1 3rem; }
  .deck button:not(.mic):not(.leave) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.deck .leave:hover { background: rgba(255, 138, 128, .12); }

/* ============ PANELLER ============ */

.veil { position: fixed; inset: 0; z-index: 8; background: rgba(5, 12, 20, .62); }
.panel {
  position: fixed; z-index: 9; top: 0; right: 0; bottom: 0;
  width: min(27rem, 100%);
  display: flex; flex-direction: column;
  background: var(--zemin-derin); border-left: 1px solid var(--cizgi);
  box-shadow: -24px 0 48px rgba(0, 0, 0, .35);
}
.panel.wide { width: min(40rem, 100%); }
.panel > header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--cizgi);
}
.panel > header h2 { font-size: 1.375rem; font-weight: 800; }
.panel .close { min-height: 2.5rem; width: 2.5rem; padding: 0; font-size: 1.5rem; line-height: 1; background: transparent; border-color: transparent; }
.panel .close:hover { background: var(--yuzey); }
.panel-body { flex: 1 1 0; overflow-y: auto; padding: 1.1rem 1.25rem 1.5rem; display: flex; flex-direction: column; gap: .45rem; }
.panel-body h3 { font-size: 1.0625rem; font-weight: 700; margin-top: .35rem; }
.panel-body label { margin-top: .35rem; }
.panel-body input + label, .panel-body select + label { margin-top: .75rem; }
.panel-body form { display: flex; flex-direction: column; gap: .45rem; }
.check { display: flex; align-items: center; gap: .55rem; margin-top: .5rem; font-weight: 500; color: var(--metin); min-height: 2rem; font-size: .9375rem; }

.row-form { display: flex; flex-direction: row !important; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row-form input { flex: 1 1 10rem; width: auto; }
.row-form select { flex: 0 1 9rem; width: auto; }
.grid-form { display: grid !important; grid-template-columns: 1fr 1fr; gap: .5rem; }
.grid-form button { grid-column: 1 / -1; }

.list { display: flex; flex-direction: column; gap: .5rem; margin-top: .6rem; }
.card {
  display: flex; align-items: center; flex-wrap: wrap; gap: .45rem .65rem;
  padding: .7rem .8rem; background: var(--yuzey); border: 1px solid var(--kart-kenar); border-radius: var(--kose);
}
.card .grow { flex: 1 1 8rem; min-width: 0; }
.card .title { font-weight: 700; overflow-wrap: anywhere; }
.card .sub { color: var(--ikincil); font-size: .8125rem; }
.card button { min-height: 2.25rem; padding: .25rem .65rem; font-size: .8125rem; }
.card select { flex: 0 1 7rem; width: auto; min-height: 2.25rem; padding: .2rem .5rem; font-size: .875rem; }
.pending { color: var(--metin); font-weight: 600; }
/* Siralama dugmeleri: kartin solunda ust uste, kucuk. */
.card .sira { display: flex; flex-direction: column; gap: .1rem; margin: -.25rem 0; }
.card .sira .icon-btn { min-height: 1.6rem; min-width: 2rem; height: 1.6rem; padding: 0; }
.card .sira .icon-btn svg { width: 1rem; height: 1rem; }
.card .sira .icon-btn:disabled { opacity: .25; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }
.countdown.soon { color: var(--hata); }

.mini-away {
  min-height: 100%; display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center; gap: 1rem;
  padding: 2rem clamp(1rem, 9vw, 7rem); font-size: 1.25rem;
}

/* ============ AVATAR ============ */

.face {
  position: absolute; left: .65rem; bottom: .5rem; z-index: 2;
  width: clamp(3rem, 9vh, 5.5rem); height: auto; border-radius: 50%;
  pointer-events: none;
}
.app.has-share .face { left: .25rem; bottom: .25rem; width: 2.6rem; }
.who-face { width: 1.15rem; height: 1.15rem; border-radius: 50%; flex: none; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr)); gap: .5rem; margin: .2rem 0 .4rem; }
.avatar-grid button {
  flex-direction: column; min-height: 0; padding: .5rem .25rem; gap: .3rem;
  font-size: .75rem; font-weight: 500;
}
.avatar-grid button img { width: 3.1rem; height: 3.1rem; }
.avatar-grid button[aria-pressed="true"] { border-color: var(--metin); background: var(--yuzey-2); box-shadow: 0 0 0 1px var(--metin); }
.avatar-grid .none { font-size: 1.6rem; width: 3.1rem; height: 3.1rem; display: grid; place-items: center; }
.avatar-admin { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ============ ACILIR MENU ============ */
/* Yerlesik <select> kullanmiyoruz: varlik listesi tazelendiginde DOM
   degisiyor ve acik liste kapaniyordu. Bu menu body'ye asili, liste
   yenilense de ayakta kalir. */

.menu {
  position: fixed; z-index: 20; min-width: 11rem; max-height: 60vh; overflow-y: auto;
  padding: .3rem; background: var(--yuzey);
  border: 1px solid var(--kart-kenar); border-radius: var(--kose);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
}
.menu .menu-title { padding: .35rem .6rem .2rem; font-size: .6875rem; letter-spacing: .05em; text-transform: uppercase; color: var(--ikincil); }
.menu button {
  width: 100%; justify-content: flex-start; min-height: 2.5rem; padding: .3rem .6rem;
  background: transparent; border-color: transparent; font-weight: 500; text-align: left;
}
.menu button:hover, .menu button:focus-visible { background: var(--yuzey-2); }
.room-who .more { min-height: 1.5rem; width: 1.5rem; min-width: 1.5rem; padding: 0; background: transparent; border-color: transparent; }
.room-who .more svg { width: .95em; height: .95em; }
.room-who li:hover .more, .room-who .more:focus-visible { opacity: 1; }
.room-who .more { opacity: .55; }

/* ============ BOSTA BEKLEYENLER (yalnizca admin) ============ */

/* Kalabalik lobide oda listesini ezmesin: kendi icinde kaysin. */
.idle-box {
  margin: .35rem .25rem .1rem; padding: .5rem .25rem .25rem;
  border-top: 1px solid var(--cizgi);
  max-height: 35%; overflow-y: auto; flex: 0 0 auto;
}
.idle-head { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; padding: 0 .35rem .3rem; }
.idle-title { flex: 1 1 auto; font-size: .6875rem; letter-spacing: .05em; text-transform: uppercase; color: var(--ikincil); }
.idle-sweep {
  flex: 0 0 auto; min-height: 1.75rem; padding: .05rem .55rem; font-size: .75rem;
  color: var(--ikincil); background: transparent; border: 1px solid var(--kart-kenar); border-radius: 999px;
}
.idle-sweep:hover { background: var(--yuzey); color: var(--metin); }
.idle-sweep.armed { background: var(--hata); border-color: var(--hata); color: var(--lacivert); font-weight: 700; }
.idle-age { font-size: .6875rem; color: var(--soluk); margin-left: auto; }
.idle-box .room-who { padding-left: .5rem; }

/* ============ SOHBET ============ */

.app.has-chat {
  grid-template-columns: 17rem minmax(0, 1fr) 22rem;
  grid-template-areas: "sidebar stage chat" "sidebar deck chat";
}
.chat {
  grid-area: chat; min-height: 0; display: flex; flex-direction: column;
  background: var(--zemin-derin); border-left: 1px solid var(--cizgi);
}
.chat-head { display: flex; align-items: center; gap: .35rem; padding: .85rem .6rem .7rem 1rem; border-bottom: 1px solid var(--cizgi); }
.chat-head h2 { flex: 1; min-width: 0; font-size: 1.0625rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-back {
  flex: 0 0 auto; max-width: 48%; min-height: 2rem; padding: .1rem .6rem;
  font-size: .75rem; color: var(--ikincil); background: transparent;
  border: 1px solid var(--kart-kenar); border-radius: 999px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-back:hover { background: var(--yuzey); color: var(--metin); }
.chat-log { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: .75rem 1rem; display: flex; flex-direction: column; gap: .65rem; }
.chat-log .empty { color: var(--ikincil); font-size: .875rem; }
.chat-day { align-self: center; font-size: .6875rem; letter-spacing: .05em; text-transform: uppercase; color: var(--ikincil); padding: .1rem .55rem; border: 1px solid var(--kart-kenar); border-radius: 999px; }
.msg { display: flex; flex-direction: column; gap: .1rem; }
.msg .meta { display: flex; align-items: baseline; gap: .45rem; font-size: .75rem; color: var(--soluk); }
.msg .meta .from { font-weight: 700; color: var(--metin); font-size: .8125rem; }
.msg .meta .from.admin::after, .msg .meta .from.mod::after { font-weight: 600; color: var(--ikincil); }
.msg .meta .from.admin::after { content: " · admin"; }
.msg .meta .from.mod::after { content: " · mod"; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9375rem; }
.msg img.shot { max-width: 100%; max-height: 14rem; margin-top: .3rem; border-radius: var(--kose-kucuk); cursor: zoom-in; }
.msg .drop { align-self: flex-start; min-height: 1.5rem; padding: 0 .35rem; font-size: .7rem; background: transparent; border-color: transparent; color: var(--ikincil); }
@media (hover: hover) {
  .msg .drop { opacity: 0; transition: opacity .12s; }
  .msg:hover .drop, .msg .drop:focus-visible { opacity: 1; color: var(--hata); }
}
.chat-form { border-top: 1px solid var(--cizgi); padding: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.chat-row { display: flex; gap: .4rem; align-items: flex-end; }
.chat-row textarea {
  flex: 1; min-width: 0; min-height: 2.75rem; max-height: 8rem; resize: none;
  padding: .55rem .7rem; width: auto;
}
.chat-row button { min-height: 2.75rem; min-width: 2.75rem; }
.chat-preview { position: relative; align-self: flex-start; }
.chat-preview img { max-width: 8rem; max-height: 5rem; border-radius: var(--kose-kucuk); display: block; }
.chat-preview .icon-btn { position: absolute; top: -.45rem; right: -.45rem; min-height: 1.6rem; min-width: 1.6rem; width: 1.6rem; background: var(--hata); color: var(--lacivert); border-radius: 50%; }
.chat-closed { padding: .6rem 1rem; color: var(--ikincil); font-size: .875rem; }
/* Okunmamis: kemik beyazi (amber "konusuyor" demek). */
.unread { background: var(--metin); color: var(--lacivert); border-radius: 999px; font-size: .6875rem; font-weight: 700; padding: 0 .4rem; min-width: 1.15rem; text-align: center; }

/* ============ TAKIMLAR ============ */

.team-pick { border: 1px solid var(--kart-kenar); border-radius: var(--kose-kucuk); padding: .5rem .7rem .7rem; margin: .25rem 0 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.team-pick legend { font-size: .75rem; color: var(--ikincil); padding: 0 .3rem; }
.team-pick label { display: inline-flex; align-items: center; gap: .35rem; font-size: .875rem; font-weight: 500; color: var(--metin); margin: 0; }
.chip-team { font-size: .6875rem; font-weight: 700; letter-spacing: .02em; padding: .05rem .45rem; border: 1px solid var(--kart-kenar); border-radius: 999px; color: var(--ikincil); }
.chip-team.mod { border-color: var(--metin); color: var(--metin); }
.keybox { display: grid; grid-template-columns: auto 1fr; gap: .2rem .75rem; margin: .4rem 0; font-size: .875rem; }
.keybox dt { color: var(--ikincil); }
.keybox dd { margin: 0; }
.mono { font-family: var(--yazi-kod); letter-spacing: .1em; font-weight: 700; overflow-wrap: anywhere; }
.card .teams { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .25rem; }
.setup-code { user-select: all; letter-spacing: .06em; font-family: var(--yazi-kod); color: var(--metin); }

/* ============ DAR EKRAN ============ */

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "deck"; }
  .sidebar {
    position: fixed; z-index: 9; inset: 0 auto 0 0; width: min(19rem, 86%);
    transform: translateX(-100%); transition: transform .18s;
  }
  /* Golge yalnizca acikken: kapaliyken ekranin sol kenarina siziyordu. */
  .app.drawer .sidebar { transform: none; box-shadow: 24px 0 48px rgba(0, 0, 0, .45); }
  .only-narrow { display: inline-flex; }
  .stage { padding: .75rem 1rem .5rem; gap: .6rem; }
  .stage-head { align-items: center; }
  .mixer { flex-direction: column; overflow-x: hidden; overflow-y: auto; flex: 1 1 auto; gap: .5rem; }
  .app.has-share .mixer { max-height: 11rem; }
  .app.has-share .strip { flex: 0 0 auto; }
  .share-thumb { width: 7rem; height: 4rem; }
  .strip { flex: 0 0 auto; flex-direction: row; max-width: none; min-width: 0; }
  .well { flex: 0 0 4.5rem; min-height: 4.5rem; }
  .initial { left: 0; right: 0; bottom: auto; top: 50%; transform: translateY(-50%); text-align: center; font-size: 2.25rem; }
  .badge { top: .2rem; right: .2rem; width: 1.5rem; height: 1.5rem; padding: .25rem; }
  .sharing-badge { top: .2rem; left: .2rem; width: 1.35rem; height: 1.35rem; padding: .2rem; }
  .plate { flex: 1; min-width: 0; padding: .5rem .65rem; gap: .2rem; }
  .who { font-size: 1.0625rem; }
  .plate-row { flex-direction: row; align-items: center; gap: .5rem; }
  .plate-row .dial { flex: 1; min-width: 0; }
  .deck { padding: .6rem .75rem calc(.75rem + env(safe-area-inset-bottom)); gap: .4rem; }
  .deck button { flex: 1 1 auto; padding: .5rem; min-height: 2.75rem; }
  .deck button span { font-size: .8125rem; }
  .deck .mic { flex: 1 1 100%; min-height: 3rem; }
  .deck .leave { margin-left: 0; }
  .grid-form { grid-template-columns: 1fr; }
  /* Sohbet dar ekranda cekmece gibi acilir. */
  .app.has-chat { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "deck"; }
  .chat {
    position: fixed; z-index: 9; inset: 0 0 0 auto; width: min(24rem, 94%);
    box-shadow: -24px 0 48px rgba(0, 0, 0, .35);
  }
  .face { left: 0; right: 0; bottom: auto; top: 50%; transform: translateY(-50%);
          width: 2.9rem; margin: 0 auto; }
}

/* ============ MINI PENCERE ============ */
/* Normal mini: kisiler ve mikrofon. */

body.mini { background: var(--zemin); }
body.mini .app {
  height: 100vh; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "stage" "deck"; gap: .4rem; padding: .4rem;
}
body.mini .stage, body.mini .deck { padding: 0; border: 0; }
body.mini .sidebar,
body.mini .stage-head,
body.mini .stage-hint,
body.mini .share-stage,
body.mini .alone,
body.mini .dial,
body.mini .threshold,
body.mini .strip-tools,
body.mini #btn-mini,
body.mini #btn-tiny,
body.mini #btn-chat,
body.mini #btn-settings,
body.mini #btn-share,
body.mini #btn-leave { display: none !important; }
body.mini .mixer { flex: 1 1 auto; flex-direction: column; overflow-y: auto; overflow-x: hidden; gap: .3rem; }
body.mini .strip { flex: 0 0 auto; flex-direction: row; min-width: 0; max-width: none; }
body.mini .chat { display: none; }
body.mini .face { width: 2rem; left: 0; right: 0; bottom: auto; top: 50%; transform: translateY(-50%); margin: 0 auto; }
body.mini .well { flex: 0 0 3rem; min-height: 3rem; }
body.mini .initial { left: 0; right: 0; bottom: auto; top: 50%; transform: translateY(-50%); text-align: center; font-size: 1.5rem; }
body.mini .badge { top: .1rem; right: .1rem; width: 1.15rem; height: 1.15rem; padding: .15rem; }
body.mini .sharing-badge { top: .1rem; left: .1rem; width: 1rem; height: 1rem; padding: .12rem; }
body.mini .plate { flex: 1; min-width: 0; padding: .35rem .5rem; justify-content: center; gap: 0; }
body.mini .who { font-size: .95rem; }
body.mini .state { font-size: .75rem; }
body.mini .deck { flex-wrap: nowrap; }
body.mini .deck .mic { flex: 1 1 auto; min-height: 2.75rem; font-size: 1rem; }
body.mini .deck #btn-deaf { flex: 0 0 auto; }
body.mini #deaf-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Kucuk pencere: yalnizca mikrofon ve kulaklik simgeleri. */

body.tiny { background: var(--zemin); }
body.tiny .app {
  height: 100vh; grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr); grid-template-areas: "deck"; gap: 0; padding: .3rem;
}
/* Sohbet de gizli: aciksa kucuk pencerede de acik kaliyor ve duzeni bozuyordu. */
body.tiny .sidebar, body.tiny .stage, body.tiny .chat { display: none !important; }
body.tiny .deck { flex-wrap: nowrap; gap: .3rem; height: 100%; padding: 0; border: 0; }
body.tiny .deck button { flex: 1 1 0; min-height: 0; height: 100%; padding: .2rem; }
body.tiny .deck button span { display: none; }
body.tiny .deck button svg { width: 1.5rem; height: 1.5rem; }
body.tiny #btn-share, body.tiny #btn-mini, body.tiny #btn-tiny,
body.tiny #btn-settings, body.tiny #btn-leave,
/* Mini ve kucuk pencerede sohbet sutunu yok (body.mini .chat gizli);
   dugmeyi birakmak "bastim ama bir sey olmadi" demek oluyordu. */
body.tiny #btn-chat { display: none !important; }
body.tiny .deck .mic { flex: 1 1 0; background: var(--metin); }
body.tiny .deck .mic[aria-pressed="true"] { background: var(--hata); }

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
