:root {
  --bg: #0e1116;
  --panel: #161b23;
  --panel-2: #1d232d;
  --line: #2a323e;
  --fg: #e6eaf0;
  --muted: #8b97a8;
  --accent: #f0364b;
  --accent-2: #d91f36;
  --danger: #d9403a;
  --ok: #3fb950;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

.view { height: 100%; }
[hidden] { display: none !important; }

/* --- Baglanti ekrani --- */

#connect-view {
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 500px at 50% -10%, #1b2432 0%, transparent 70%),
    var(--bg);
}

.card {
  width: min(380px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }

.brand-mark {
  /* Resmi logo (KARAR 92) ~1,6:1 genis; yukseklik iki satirlik basliga denk. */
  width: 56px; height: 35px;
  flex: none;
  display: block;
  object-fit: contain;
}

.brand h1 { margin: 0; font-size: 19px; font-weight: 600; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

form label {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
}

form input {
  width: 100%;
  padding: 11px 13px;
  margin-bottom: 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 16px;
  letter-spacing: .5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 54, 75, .18);
}

#code { font-variant-numeric: tabular-nums; letter-spacing: 3px; }

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: var(--radius);
}

#connect-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  transition: background .15s;
}

#connect-btn:hover:not(:disabled) { background: var(--accent-2); }
#connect-btn:disabled { opacity: .55; cursor: default; }

.error {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: rgba(217, 64, 58, .12);
  border: 1px solid rgba(217, 64, 58, .35);
  border-radius: 8px;
  color: #ff9d99;
  font-size: 13px;
}

.auto-connect {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }

.dot-line { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px rgba(63, 185, 80, .6); }
.dot.err { background: var(--danger); }

/* --- Oturum ekrani --- */

#session-view { display: flex; flex-direction: column; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 12px;
  height: 46px;
  flex: none;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.tb-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.tb-logo { flex: none; display: block; object-fit: contain; }
.tb-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-code { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Kayit gostergesi; ekran durgunken (kayda ara) soluklasir. */
.kayit-rozet {
  font-size: 12px; font-weight: 600; color: #fff; background: #c62828;
  border-radius: 20px; padding: 2px 10px; letter-spacing: .02em;
  animation: kayitNabiz 2s ease-in-out infinite;
}
.kayit-rozet.duraklatildi { background: #6b7280; animation: none; }
@keyframes kayitNabiz { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.tb-center { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.tb-right { display: flex; align-items: center; gap: 8px; }

.tb-field, .tb-check {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); white-space: nowrap;
}

.tb-field select {
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 7px;
  font: inherit;
  outline: none;
}

.tb-check input { accent-color: var(--accent); }

.tb-btn {
  padding: 7px 11px;
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--line);
  font-size: 12.5px;
  transition: background .12s;
}

.tb-btn:hover { background: #29313d; }
.tb-btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.tb-btn.danger:hover { background: #b83530; }

.kayit-dugme { color: #ff8a80; border-color: #5b2f2f; }
.kayit-dugme:hover { background: #3a2020; }
.kayit-dugme.aktif { background: #c62828; border-color: #c62828; color: #fff; }
.kayit-dugme.aktif:hover { background: #b02020; }
.kayit-dugme:disabled { opacity: .55; cursor: default; }

.work {
  flex: 1;
  min-height: 0;
  display: flex;
}

.stage {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  background: #05070a;
  overflow: hidden;
}

/* Yakinlastirilmis tuval kaydirilarak gezilir; place-items start (ortalamayi app.js yapar). */
.stage.yakinlastirilmis {
  overflow: auto;
  place-items: start;
  scrollbar-width: thin;
}
.stage.yakinlastirilmis #screen-canvas { max-width: none; max-height: none; }

/* Olcek app.js fitCanvas ile verilir; bu sinirlar ilk kareye kadar tasmayi onler. */
#screen-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  outline: none;
  cursor: default;
  image-rendering: auto;
  /* Parmak hareketleri bize ait: yoksa tarayici kaydirir/yakinlastirir ve pointercancel duser. */
  touch-action: none;
  /* Basili tutunca tarayicinin sec/kaydet balonu cikmasin. */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

#screen-canvas.no-control { cursor: default; }

/* --- Dokunmatik kullanim --- */

/* Ekran klavyesi tutamagi: gercekten odaklanabilir olmali (display:none olursa klavye acilmaz). */
.dokunma-klavye {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  background: transparent;
  /* iOS 16px alti alanda sayfayi yakinlastirir. */
  font-size: 16px;
  pointer-events: none;
}

.dokunma-ipucu {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  max-width: min(90%, 420px);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(8, 12, 20, .88);
  color: #e8eefc;
  font-size: 12.5px;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  z-index: 6;
}

.dokunma-yardim {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(4, 7, 12, .72);
  z-index: 7;
  padding: 16px;
}
.dokunma-yardim .dy-kart {
  width: min(420px, 100%);
  max-height: 100%;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.dokunma-yardim h4 { margin: 0 0 10px; font-size: 15px; }
.dokunma-yardim dl {
  margin: 0 0 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 13px;
}
.dokunma-yardim dt { font-weight: 600; white-space: nowrap; }
.dokunma-yardim dd { margin: 0; color: var(--muted); }
.dokunma-yardim .pbtn { width: 100%; }

.tb-btn.is-on { background: var(--accent); color: #fff; }

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  background: rgba(5, 7, 10, .9);
  color: var(--muted);
}

.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.statusbar {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 26px;
  flex: none;
  padding: 0 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.grow { flex: 1; }

/* Telefon: orta bolum gizlenmez; cubuk iki satir olur, orta bolum yatay kayar. */
@media (max-width: 780px) {
  .toolbar {
    height: auto;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 8px;
    row-gap: 6px;
  }
  .tb-left { order: 1; flex: 1 1 auto; }
  .tb-right { order: 2; flex: 0 0 auto; gap: 4px; }
  .tb-center {
    order: 3;
    flex: 1 0 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .tb-center::-webkit-scrollbar { display: none; }
  .tb-center > * { flex: none; }
  .tb-btn { padding: 8px 10px; font-size: 12px; min-height: 36px; }
  .tb-check { min-height: 36px; }
}

/* --- Yan panel: sohbet + dosya --- */

.side {
  flex: none;
  width: 320px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
}

.side-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px 0;
  flex: none;
  border-bottom: 1px solid var(--line);
}

.side-tab {
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  border-radius: 8px 8px 0 0;
  font-size: 12.5px;
}

.side-tab:hover { color: var(--fg); }

.side-tab.is-on {
  background: var(--panel-2);
  color: var(--fg);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.side-close {
  margin-left: auto;
  padding: 6px 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.side-close:hover { color: var(--fg); }

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

/* --- Sohbet --- */

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg { max-width: 88%; }
.msg.me { align-self: flex-end; }
.msg.them { align-self: flex-start; }
.msg.sys { align-self: center; max-width: 100%; }

.msg-body {
  padding: 7px 11px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.me .msg-body { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.them .msg-body { background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }

.msg.sys .msg-body {
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
  padding: 2px 0;
}

.msg-time { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.msg.me .msg-time { text-align: right; }

.chat-form {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.chat-form input:focus { border-color: var(--accent); }

.send-btn {
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: background .12s;
}

.send-btn:hover:not(:disabled) { background: var(--accent-2); }
.send-btn:disabled { opacity: .5; cursor: default; }

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .side { width: 260px; }
}

@media (max-width: 700px) {
  .work { position: relative; }
  .side { position: absolute; inset: 0 0 0 auto; width: min(300px, 100%); z-index: 5; }
}

.target {
  margin: -10px 0 20px;
  padding: 10px 12px;
  background: rgba(240, 54, 75, .1);
  border: 1px solid rgba(240, 54, 75, .3);
  border-radius: 8px;
  color: #8fc0ff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

/* --- Baglanti ekrani: iki sutun (solda bu bilgisayar, sagda uzak bilgisayar) --- */

#connect-view .card { max-width: 840px; width: 100%; }

.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}
@media (max-width: 760px) { .panes { grid-template-columns: 1fr; } }

.panes .pane {
  padding: 18px 20px 20px;
  background: var(--panel-2, rgba(255, 255, 255, .035));
  border: 1px solid var(--line);
  border-radius: 12px;
}

.pane-title {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .10em;
  color: var(--fg);
  text-transform: uppercase;
}
.pane-sub { margin: 0 0 18px; font-size: 11.5px; color: var(--muted); }

.self-code, .self-pass {
  flex: 1;
  min-width: 0;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  user-select: all;
  overflow-wrap: anywhere;
}
.self-pass { font-size: 26px; }

.kopya, .ikon {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--fg);
  font-size: 12px;
  cursor: pointer;
}
.ikon { padding: 8px 10px; }
.kopya:hover, .ikon:hover { background: var(--panel-2, rgba(255,255,255,.08)); }
.kopya.ok { border-color: #3f9150; color: #7ee08f; }

#remote-box label {
  display: block;
  margin-bottom: 4px;
  font-size: 10.5px;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
}
.kod-satir { position: relative; display: flex; gap: 8px; }
.kod-satir input { flex: 1; min-width: 0; }

/* Son kullanilan ID'ler: ID satirinin tam genisligi. */
.son-id-liste {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 200px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}
.son-id-liste button {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  background: none;
  color: var(--fg);
  text-align: left;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.son-id-liste button:hover { background: var(--panel-2, rgba(255,255,255,.08)); }

.foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* --- Oturum bildirimi: kisa haberler sag altta --- */
.oturum-bildirim {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9998;
  max-width: min(360px, calc(100vw - 32px));
  padding: 11px 15px;
  border: 1px solid var(--line, #2a3441);
  border-left: 3px solid var(--accent, #f0364b);
  border-radius: 10px;
  background: var(--panel, #161b22);
  color: var(--fg, #e6edf3);
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;   /* uzak ekranda tiklamayi engellemesin */
}
.oturum-bildirim.gorunur { opacity: 1; transform: translateY(0); }
.ekran-yenile {
  width: 24px; height: 24px;
  flex: none;
  border: 1px solid var(--line, #2a3441);
  border-radius: 6px;
  background: transparent;
  color: var(--muted, #8b949e);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.ekran-yenile:hover { color: var(--fg, #e6edf3); border-color: var(--accent, #f0364b); }
.ekran-yenile:disabled { opacity: .4; cursor: default; }

/* --- Emoji secici: body'ye eklenir, konumu emoji.js verir (fixed) --- */
.emoji-btn,
.ek-btn {
  flex: none;
  width: 34px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--fg);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.emoji-btn:hover,
.ek-btn:hover { border-color: var(--accent); background: var(--panel-2); }

.emoji-panel {
  position: fixed;
  z-index: 60;
  width: 300px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
  overflow: hidden;
}

.emoji-sekmeler {
  display: flex;
  gap: 2px;
  padding: 6px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.emoji-sekme {
  flex: 1;
  padding: 5px 0;
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: .6;
}

.emoji-sekme:hover { opacity: 1; background: var(--panel); }
.emoji-sekme.is-on { opacity: 1; background: var(--panel); box-shadow: inset 0 -2px 0 var(--accent); }

.emoji-govde {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  max-height: 210px;
  overflow-y: auto;
}

.emoji-hucre {
  padding: 4px 0;
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 19px;
  line-height: 1.2;
  cursor: pointer;
}

.emoji-hucre:hover { background: var(--panel-2); }

.emoji-bos {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* --- Dosya aktarimi (yan panel) --- */
.drop-zone {
  margin: 10px;
  padding: 18px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color .15s, background .15s;
}
.drop-zone strong { color: var(--fg); font-size: 13px; }
.drop-zone span   { color: var(--muted); font-size: 12px; }
.drop-zone kbd {
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
  font-family: inherit;
  font-size: 11px;
}
.drop-zone.is-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel-2));
}
.drop-zone .send-btn { margin-top: 4px; }

.file-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.file-row {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
.file-row .fr-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.file-row .fr-name {
  flex: 1;
  color: var(--fg);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-row .fr-size { color: var(--muted); font-size: 11px; white-space: nowrap; }
.file-row .fr-durum { color: var(--muted); font-size: 11px; margin-top: 3px; }
.file-row.ok  .fr-durum { color: var(--ok); }
.file-row.err .fr-durum { color: var(--danger); }
.file-row .fr-bar {
  height: 3px;
  margin-top: 6px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.file-row .fr-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .2s;
}
.file-row .fr-link {
  display: inline-block;
  margin-top: 5px;
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
}
.file-row .fr-link:hover { text-decoration: underline; }

.file-row button.fr-eylem {
  display: block;
  background: none;
  border: 0;
  padding: 0;
  margin-top: 5px;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
}
.file-row button.fr-eylem:hover:not(:disabled) { text-decoration: underline; }
.file-row button.fr-eylem:disabled { color: var(--muted); cursor: default; }


/* --- Sade oturum (toplantidan devralma, URL "&sade=1"): yalnizca fare ve klavye --- */
body.sade-oturum .toolbar { display: none !important; }
body.sade-oturum #session-view { padding: 0; position: relative; }
body.sade-oturum #session-view .stage { border-radius: 0; }
/* Sade kipte yan panel yalnizca dosya icin (pano/aktarim ilerlemesi); sohbet gizli. */
body.sade-oturum #tab-chat,
body.sade-oturum #chat-pane { display: none !important; }
body.sade-oturum #tab-files { pointer-events: none; }

/* Kenar tutamagi: paneli acar/toplar; panel acikken onun soluna kayar. */
.sade-dosya {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border: 1px solid var(--line, #2a3340);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: var(--panel, #161c24);
  color: var(--fg, #e6edf3);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
.sade-dosya[hidden] { display: none; }
.sade-dosya:hover { background: var(--panel-2, #1d242e); }
.sade-dosya.acik { right: var(--yan-genislik, 320px); }
.sade-dosya-ok { font-size: 14px; line-height: 1; }
.sade-dosya-yazi { writing-mode: vertical-rl; letter-spacing: .06em; }

/* --- Oturum arac cubugu: simgeli, gruplu duzen ---
"#session-view .toolbar" ile yazilir: ID ozgullugu olmadan portal.css/gorunum.css'in
acik tema kurallari kazaniyordu. Renkler yalnizca tema degiskenlerinden. */
#session-view .toolbar {
  --tb-h: 30px;
  --tb-zemin: color-mix(in srgb, var(--fg) 4.5%, transparent);
  --tb-ustu: color-mix(in srgb, var(--fg) 9%, transparent);
  --tb-basili: color-mix(in srgb, var(--fg) 14%, transparent);
  --tb-halka: color-mix(in srgb, var(--accent) 65%, transparent);
  height: 52px;
  gap: 12px;
  padding: 0 12px;
  background: var(--yz-basliksirti, var(--panel));
  box-shadow: inset 0 -1px 0 var(--line);
  border-bottom: 0;
}

#session-view .tb-left { gap: 10px; flex: 0 1 auto; min-width: 110px; }
#session-view .tb-kim { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
#session-view .tb-title { font-size: 13.5px; }
#session-view .tb-code { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#session-view .tb-center { gap: 10px; margin-left: auto; }
#session-view .tb-right  { gap: 10px; }

/* --- Simgeler --- */
#session-view .toolbar .ik {
  width: 16px; height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#session-view .toolbar .ik .dolu { fill: currentColor; stroke: none; }

/* --- Grup kutusu --- */
#session-view .toolbar .tb-grup,
#session-view .toolbar .tb-ekranlar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  height: auto;
  background: var(--tb-zemin);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: none;
}
#session-view .toolbar .tb-ekranlar:hover { border-color: var(--line); }

/* --- Dugme --- */
#session-view .toolbar .tb-btn,
#session-view .toolbar .tb-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--tb-h);
  min-width: var(--tb-h);
  padding: 0 10px;
  background: transparent;
  color: var(--fg);
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease, box-shadow .12s ease;
}
#session-view .toolbar .tb-btn:not(:has(.tb-lbl)) { padding: 0; width: var(--tb-h); }
#session-view .toolbar .tb-btn:hover:not(:disabled),
#session-view .toolbar .tb-toggle:hover { background: var(--tb-ustu); }
#session-view .toolbar .tb-btn:active:not(:disabled) { background: var(--tb-basili); transform: translateY(.5px); }
#session-view .toolbar .tb-btn:focus-visible,
#session-view .toolbar .tb-toggle:has(input:focus-visible),
#session-view .toolbar .mon:focus-visible,
#session-view .toolbar .ekran-yenile:focus-visible,
#session-view .toolbar .tb-field select:focus-visible {
  outline: 2px solid var(--tb-halka);
  outline-offset: 1px;
}
#session-view .toolbar .tb-btn:disabled { cursor: default; opacity: .6; }

#session-view .toolbar .badge { margin-left: 0; min-width: 16px; height: 16px; font-size: 10px; }

/* --- Kalite / Gorunum / FPS --- */
#session-view .toolbar .tb-ayarlar .tb-field {
  height: var(--tb-h);
  gap: 5px;
  padding: 0 2px 0 8px;
  color: var(--muted);
  border: 0;
  border-radius: 7px;
  box-shadow: none;
  font-size: 12px;
  cursor: pointer;
  transition: background .12s ease;
}
#session-view .toolbar .tb-ayarlar .tb-field:hover { background: var(--tb-ustu); }
#session-view .toolbar .tb-ayarlar .tb-field + .tb-field { position: relative; }
#session-view .toolbar .tb-ayarlar .tb-field + .tb-field::before {
  content: "";
  position: absolute;
  left: -1px; top: 7px; bottom: 7px;
  width: 1px;
  background: var(--line);
}
#session-view .toolbar .tb-field select {
  height: 24px;
  padding: 0 4px;
  background: transparent;
  color: var(--fg);
  border: 0;
  border-radius: 5px;
  box-shadow: none;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  field-sizing: content;          /* secili secenek kadar genis (Chromium/WebView2) */
}
#session-view .toolbar .tb-field select option { background: var(--panel); color: var(--fg); }

/* --- Kontrol anahtari: kutu gorunmez ama odaklanabilir --- */
#session-view .toolbar .tb-toggle { color: var(--muted); border-color: var(--line); }
#session-view .toolbar .tb-toggle input {
  position: absolute; inset: 0;
  margin: 0; opacity: 0;
  cursor: inherit;
}
#session-view .toolbar .tb-toggle .ik-acik { display: none; }
#session-view .toolbar .tb-toggle:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 6px color-mix(in srgb, var(--accent) 35%, transparent);
}
#session-view .toolbar .tb-toggle:has(input:checked):hover {
  background: color-mix(in srgb, var(--accent) 88%, #000);
}
#session-view .toolbar .tb-toggle:has(input:checked) .ik-acik { display: block; }
#session-view .toolbar .tb-toggle:has(input:checked) .ik-kapali { display: none; }
#session-view .toolbar .tb-toggle:has(input:disabled) { cursor: not-allowed; }

/* --- Tam Erisim --- */
#session-view .toolbar .tb-tam-erisim {
  color: color-mix(in srgb, var(--accent) 80%, var(--fg));
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
#session-view .toolbar .tb-tam-erisim:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
#session-view .toolbar .tb-tam-erisim .ik-bekle { display: none; }
#session-view .toolbar .tb-tam-erisim.bekliyor { color: var(--muted); border-color: var(--line); opacity: 1; cursor: progress; }
#session-view .toolbar .tb-tam-erisim.bekliyor .ik-hazir { display: none; }
#session-view .toolbar .tb-tam-erisim.bekliyor .ik-bekle { display: block; animation: tbDon 0.9s linear infinite; }
@keyframes tbDon { to { transform: rotate(360deg); } }

/* --- Kayit --- */
#session-view .toolbar .kayit-dugme { color: #e5484d; }
#session-view .toolbar .kayit-dugme .ik-durdur { display: none; }
#session-view .toolbar .kayit-dugme:hover:not(:disabled) { background: color-mix(in srgb, #e5484d 14%, transparent); }
#session-view .toolbar .kayit-dugme.aktif { background: #c62828; border-color: #c62828; color: #fff; }
#session-view .toolbar .kayit-dugme.aktif:hover:not(:disabled) { background: #b02020; }
#session-view .toolbar .kayit-dugme.aktif .ik-kaydet { display: none; }
#session-view .toolbar .kayit-dugme.aktif .ik-durdur { display: block; }

/* --- Baglantiyi Kes --- */
#session-view .toolbar .tb-btn.danger {
  height: 34px;
  padding: 0 14px;
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-weight: 600;
  border-radius: 9px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 3px 10px color-mix(in srgb, var(--danger) 30%, transparent);
}
#session-view .toolbar .tb-btn.danger:not(:has(.tb-lbl)),
#session-view .toolbar .tb-btn.danger .tb-lbl:empty { padding: 0; }
#session-view .toolbar .tb-btn.danger .ik { stroke-width: 2.3; }
#session-view .toolbar .tb-btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 86%, #000); }
#session-view .toolbar .tb-btn.danger:active:not(:disabled) { background: color-mix(in srgb, var(--danger) 76%, #000); }
#session-view .toolbar .tb-btn.danger:focus-visible { outline-color: color-mix(in srgb, var(--danger) 70%, transparent); }

#session-view .toolbar .oturum-sure { height: 26px; display: inline-flex; align-items: center; }

/* --- Monitor secici --- */
.gorsel-gizli {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  margin: -1px !important; padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  border: 0 !important;
  white-space: nowrap !important;
}
#session-view .toolbar .tb-ekranlar { gap: 2px; padding: 2px 3px; cursor: default; }
#session-view .ekran-secici { display: flex; align-items: center; gap: 2px; }
#session-view .mon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  min-width: 42px;
  padding: 0 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
#session-view .mon svg { width: 32px; height: 27px; display: block; overflow: visible; }
#session-view .mon .mon-cam {
  fill: color-mix(in srgb, var(--fg) 6%, transparent);
  stroke: currentColor;
  stroke-width: 1.7;
  transition: fill .12s ease, stroke .12s ease;
}
#session-view .mon .mon-ayak { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
#session-view .mon text {
  fill: currentColor;
  font: 700 12.5px/1 "Segoe UI", system-ui, sans-serif;
  dominant-baseline: central;
}
#session-view .mon .mon-yazi { font-size: 11.5px; font-weight: 600; }
#session-view .mon:hover { color: var(--fg); background: var(--tb-ustu); }

#session-view .mon.secili {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
#session-view .mon.secili .mon-cam { fill: var(--accent); stroke: var(--accent); }
#session-view .mon.secili text { fill: #fff; }
#session-view .mon.secili.mon-tumu .mon-cam { fill: color-mix(in srgb, var(--accent) 80%, transparent); }
#session-view .mon.secili::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -4px;
  width: 16px; height: 3px;
  margin-left: -8px;
  border-radius: 2px;
  background: var(--accent);
}

#session-view .ekran-secici.tek .mon { cursor: default; }
#session-view .ekran-secici.tek .mon.secili {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}
#session-view .ekran-secici.tek .mon.secili .mon-cam {
  fill: color-mix(in srgb, var(--fg) 10%, transparent);
  stroke: currentColor;
}
#session-view .ekran-secici.tek .mon.secili text { fill: var(--fg); }
#session-view .ekran-secici.tek .mon.secili::after { display: none; }

#session-view .toolbar .ekran-yenile {
  display: inline-grid;
  place-items: center;
  width: 26px; height: 26px;
  margin-left: 2px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 7px 7px 0;
  background: transparent;
  color: var(--muted);
}
#session-view .toolbar .ekran-yenile .ik { width: 14px; height: 14px; }
#session-view .toolbar .ekran-yenile:hover:not(:disabled) { color: var(--fg); background: var(--tb-ustu); }
#session-view .toolbar .ekran-yenile:disabled .ik { animation: tbDon 0.9s linear infinite; }

/* --- Daralinca: once yazilar gider; 1000px altinda orta bolum ikinci satira iner --- */
@media (max-width: 1700px) {
  #session-view .toolbar .tb-ayarlar .tb-lbl { display: none; }
}
@media (max-width: 1600px) {
  #session-view .toolbar .tb-araclar .tb-lbl { display: none; }
  #session-view .toolbar .tb-araclar .tb-btn { padding: 0; width: var(--tb-h); }
  #session-view .toolbar .tb-araclar .badge { position: absolute; top: -4px; right: -4px; }
}
@media (max-width: 1320px) {
  #session-view .toolbar .tb-erisim .tb-lbl,
  #session-view .mon .mon-yazi { display: none; }
  #session-view .toolbar .tb-erisim .tb-btn,
  #session-view .toolbar .tb-toggle { padding: 0; width: var(--tb-h); }
}
@media (max-width: 1180px) {
  #session-view .toolbar .tb-lbl { display: none; }
  #session-view .toolbar .tb-btn.danger { padding: 0; width: 34px; }
  #session-view .toolbar .tb-code { display: none; }
  #session-view .toolbar .tb-ayarlar .tb-field { padding-left: 6px; }
  #session-view .toolbar { gap: 8px; }
  #session-view .tb-center, #session-view .tb-right { gap: 8px; }
}
@media (max-width: 1000px) {
  #session-view .toolbar {
    height: auto;
    flex-wrap: wrap;
    row-gap: 6px;
    padding: 6px 8px;
  }
  #session-view .tb-left { order: 1; flex: 1 1 auto; }
  #session-view .tb-right { order: 2; flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  #session-view .tb-center {
    order: 3;
    flex: 1 0 100%;
    margin-left: 0;
    justify-content: safe center;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    padding-bottom: 5px;          /* secili monitorun alt cizgisi kesilmesin */
  }
  #session-view .tb-center::-webkit-scrollbar { display: none; }
}
