/* ================= Liveink — tahta görünümü ================= */
:root {
  --bg: #f0f0ee;
  --board: #ffffff;
  --bar: #ffffff;
  --text: #1c1e26;
  --text-2: #4b4f5c;
  --muted: #9a9da8;
  --border: #e6e6e1;
  --accent: #3a5bd9;
  --accent-soft: #e9edfb;
  --danger: #c2374b;
  --shadow: rgba(28, 30, 38, .08);
}
[data-theme="dark"] {
  --bg: #15161a;
  --board: #23252b;
  --bar: #1e2025;
  --text: #e8eaed;
  --text-2: #c3c6cf;
  --muted: #7e828e;
  --border: #34363d;
  --accent: #6b8afd;
  --accent-soft: #2a3350;
  --danger: #f27b8c;
  --shadow: rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  display: flex; flex-direction: column;
  touch-action: none;
}
.ic { stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* ---------- Araç çubuğu ---------- */
#toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  min-height: 54px;
  padding: 7px 12px;
  background: var(--bar);
  border-bottom: 1px solid var(--border);
  user-select: none;
  position: relative; z-index: 25; /* 4.8: yukarı kayarken sayfanın üstünde kalsın (amblem z-30 üstte) */
}
#logoMark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; text-decoration: none;
  /* 4.4: amblem artık tıklanır (üst çubuğu küçültür) — pointer-events:none kaldırıldı.
     4.3'te tıklama bu satır yüzünden ambleme hiç ulaşmıyordu. */
  margin-right: 2px; flex-shrink: 0; cursor: pointer; user-select: none;
}
.group { display: flex; align-items: center; gap: 3px; }
.tbBrk { display: none; } /* dar ekranda satır kırma noktası */
.sep { width: 1px; height: 24px; background: var(--border); margin: 0 6px; }
.spacer { flex: 1; }

button.tool, a.tool {
  border: none; background: transparent; color: var(--text-2);
  font-family: inherit; font-size: 14px; cursor: pointer; line-height: 1;
  border-radius: 9px; padding: 8px 11px;
  display: flex; align-items: center; gap: 7px; text-decoration: none;
}
button.tool:hover, a.tool:hover { background: var(--bg); }
button.tool.active { background: var(--accent-soft); color: var(--accent); }
button.tool:disabled { opacity: .35; cursor: default; }
.iconbtn { width: 36px; height: 36px; padding: 0; justify-content: center; }
.iconbtn.wide { width: auto; padding: 0 11px; gap: 6px; }
.iconbtn.wide b { font-size: 13px; font-weight: 600; }

/* ipucu kutusu: üzerine gelince isim */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: #23252e; color: #f4f4f2;
  font-size: 12px; font-weight: 500; padding: 5px 9px; border-radius: 6px;
  white-space: nowrap; z-index: 120; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}

/* renkler */
.swatch {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.6px solid var(--border); cursor: pointer; flex-shrink: 0;
}
.swatch.active { box-shadow: 0 0 0 2px var(--bar), 0 0 0 3.6px var(--accent); border-color: transparent; }
.swatch.plus {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); background: transparent; border-style: dashed;
}
.swatchSep { width: 1px; height: 18px; background: var(--border); margin: 0 3px; }
#colors { gap: 6px; padding: 0 2px; }

/* kalınlık */
input[type="range"] { width: 76px; accent-color: var(--accent); }

/* sayfa gezinme + zoom */
#pageInput {
  width: 44px; text-align: center; font-size: 13.5px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg); color: var(--text); padding: 5px 2px;
}
#pageTotal { font-size: 13.5px; color: var(--muted); padding: 0 2px; white-space: nowrap; }
#zoomLabel { font-size: 13px; color: var(--text-2); min-width: 42px; text-align: center; }
/* araç düğmesi + seçenek menüsü (silgi türü, kaybolma biçimi) */
.toolWrap { position: relative; display: flex; }
.toolWrap:has(.menu.open) [data-tip]:hover::after { display: none; } /* menü açıkken ipucu menünün üstüne binmesin */
.menu.tmenu { left: 0; right: auto; min-width: 170px; }
.mItem .ic { flex-shrink: 0; } /* dar menüde simge ezilmesin */
#penMenu { min-width: 240px; }
.mItem .mCheck { margin-left: auto; color: var(--accent); }
/* menüde açma/kapama anahtarı (karalayarak silme gibi modlar için) */
.sw { margin-left: auto; flex-shrink: 0; width: 30px; height: 17px; border-radius: 9px; background: var(--border); position: relative; transition: background .15s; cursor: pointer; }
.sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .15s; }
.sw.on { background: var(--accent); }
.sw.on::after { left: 15px; }

/* ---------- Kalınlık önizlemesi (sayfanın görünen kısmında örnek çizgi) ---------- */
#widthPrevOv { position: absolute; z-index: 8; pointer-events: none; }
/* Sayfa stili penceresi (Ramis 5.0; 5.2: kategorili, yön seçimi yok) */
.stilModal { display: flex; flex-direction: column; max-height: min(86vh, 660px); width: min(500px, 96vw); }
#stilListe { flex: 1; overflow: auto; padding: 2px 2px 10px; }
.stilKat {
  font-size: 11.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: var(--muted); margin: 14px 2px 8px; padding-top: 10px; border-top: 1px solid var(--border);
}
.stilKat:first-child { margin-top: 4px; padding-top: 0; border-top: none; }
.stilGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.stilSec { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 7px 4px 6px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--bg); position: relative; }
.stilSec img { object-fit: cover; background: #fff; border: 1px solid var(--border); border-radius: 4px; }
.stilSil { /* özel stili silme düğmesi (köşede küçük ×) */
  position: absolute; top: 3px; right: 3px; z-index: 2;
  width: 20px; height: 20px; border: none; border-radius: 7px; cursor: pointer;
  background: var(--bar); color: var(--danger); font-size: 14px; line-height: 1;
  box-shadow: 0 1px 4px var(--shadow);
}
.stilEkle { justify-content: center; border-style: dashed; color: var(--muted); min-height: 120px; }
.stilEkle .arti { font-size: 26px; line-height: 1; }
.stilSec:hover { border-color: var(--accent); }
.stilSec.on { border-color: var(--accent); outline: 1.5px solid var(--accent); }
.stilSec canvas { background: #fff; border: 1px solid var(--border); border-radius: 4px; }
.stilSec span { font-size: 10.5px; color: var(--text-2); text-align: center; line-height: 1.15; }

/* ---------- Üçlü seçim (PDF gece modu) ---------- */
.seg { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; flex-shrink: 0; }
.seg button { border: none; background: var(--bar); color: var(--text-2); font-size: 12px; padding: 6px 9px; cursor: pointer; border-left: 1px solid var(--border); }
.seg button:first-child { border-left: none; }
.seg button.on { background: var(--accent); color: #fff; }

/* ---------- Sayfa ızgarası ---------- */
.modal.gridModal { width: min(900px, 96vw); }
#gridBody { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; padding: 4px 0 8px; }
.gCell {
  position: relative; cursor: pointer; overflow: hidden;
  border: 2px solid var(--border); border-radius: 9px; background: #fff;
  transition: border-color .12s, transform .12s;
}
.gCell:hover { border-color: var(--accent); transform: translateY(-2px); }
.gCell.cur { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(58, 91, 217, .25); }
.gCell canvas { display: block; }
.gNum {
  position: absolute; left: 5px; bottom: 5px;
  background: rgba(15, 27, 51, .78); color: #fff;
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 7px;
}

/* ---------- Kenardan ayar paneli ---------- */
#setDim { position: fixed; inset: 0; z-index: 39; background: rgba(15, 27, 51, .05); opacity: 0; pointer-events: none; transition: opacity .2s; } /* neredeyse şeffaf: panel açıkken sayfa görünür kalsın (PDF görünümü ayarlanırken sonuç izlenebilsin) */
#setPanel {
  position: fixed; top: 0; right: 0; z-index: 40; height: 100%;
  width: 320px; max-width: 88vw;
  touch-action: pan-y; /* dokunmatikte yatay hareketi tarayıcı yutmasın: sağa sürükleyip kapatma çalışsın */
  background: var(--bar); color: var(--text);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 32px var(--shadow);
  padding: 12px; overflow: auto;
  transform: translateX(105%); transition: transform .2s;
}
body.setOpen #setDim { opacity: 1; pointer-events: auto; }
/* Panel boyu tutamacı: sol kenardan sürükleyerek paneli daralt/genişlet (boy hatırlanır) */
#setTutamac { position: absolute; left: 0; top: 0; bottom: 0; width: 16px; cursor: ew-resize; touch-action: none; z-index: 2; }
#setTutamac::after {
  content: ''; position: absolute; left: 5px; top: 50%; width: 4px; height: 46px;
  margin-top: -23px; border-radius: 2px; background: var(--border);
}
body.setOpen #setPanel { transform: none; }
.setSec { margin: 16px 4px 6px; font-size: 11px; font-weight: 800; letter-spacing: .8px; color: var(--muted); }
.setRow { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-top: 1px solid var(--border); font-size: 13.5px; }
.setRow:first-of-type { border-top: none; }
.setSol { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.setHint { font-size: 11.5px; color: var(--muted); }
.setRow input[type=range] { width: 110px; }
.setDoc { display: flex; align-items: center; gap: 9px; padding: 4px 4px 8px; }
.setDocIco { width: 30px; height: 30px; border-radius: 8px; background: var(--bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--accent); }
.setDocTxt { display: flex; flex-direction: column; font-size: 13.5px; min-width: 0; }
.setDocTxt #docName { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kodKutu { display: flex; align-items: center; gap: 10px; margin: 2px 4px 6px; padding: 10px 12px; background: var(--bg); border: 1px dashed var(--border); border-radius: 11px; }
.kodBig { flex: 1; font-family: ui-monospace, Consolas, monospace; font-weight: 700; font-size: 20px; letter-spacing: 3px; }
#docName { font-size: 12.5px; color: var(--muted); max-width: 130px;
           overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#status {
  font-size: 12.5px; color: var(--muted);
  display: flex; align-items: center; gap: 7px; padding-left: 6px;
}
#status b { color: var(--text-2); font-weight: 600; }
.codeChip {
  font-family: ui-monospace, monospace; font-size: 12px; font-weight: 600; letter-spacing: 1px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 8px; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.codeChip:hover { border-color: var(--accent); color: var(--accent); }
#dot { width: 8px; height: 8px; border-radius: 50%; background: #d33; flex-shrink: 0; }
#dot.on { background: #2fa35f; }

/* ---------- Tahta / sayfa ---------- */
#boardWrap {
  flex: 1; position: relative;
  overflow: auto;
  touch-action: none;            /* tarayıcı dokunmayı ele geçirmesin: biz çizeriz */
}
#pageWrap {
  position: relative;
  margin: 16px auto;
  background: var(--board);
  border-radius: 2px;
  box-shadow: 0 2px 16px var(--shadow);
  touch-action: none;
  transform-origin: 0 0;
}
/* TI-84 hesap makinesi penceresi (Ramis 5.7): yüzen, taşınabilir, boyutlanabilir */
#hesapWin {
  position: fixed; z-index: 45; display: flex; flex-direction: column;
  background: var(--bar); border: 1px solid var(--border); border-radius: 13px;
  box-shadow: 0 12px 40px var(--shadow); overflow: hidden;
}
#hesapBas {
  display: flex; align-items: center; gap: 7px; padding: 6px 6px 6px 12px;
  border-bottom: 1px solid var(--border); cursor: move; user-select: none; touch-action: none;
  font-size: 13.5px; color: var(--text-2);
}
#hesapBas .spacer { flex: 1; }
#hesapGovde { flex: 1; position: relative; background: #fff; overflow: hidden; }
/* 6.2: iframe sabit iç boyutta tutulur; JS, sitedeki makinenin bulunduğu bölgeyi
   kırpıp pencereye oran koruyarak sığdırır (başlık/telif yazısı görünmez) */
#hesapGovde iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; }
.hesapNot { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #8a93a6; font-size: 13px; padding: 16px; text-align: center; }
#hesapTut {
  position: absolute; right: 0; bottom: 0; width: 22px; height: 22px;
  cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 50%, var(--border) 50%);
  border-bottom-right-radius: 13px;
}

/* Sürekli sayfa akışı (Ramis 5.4): komşu sayfaların canlı önizlemeleri */
.akisSayfa {
  position: relative; overflow: hidden;
  background: var(--board);
  border-radius: 2px;
  box-shadow: 0 2px 16px var(--shadow);
  touch-action: none;
  opacity: .96;
}
.akisSayfa canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

#pageWrap canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: transparent;
  touch-action: none;
}
#board { cursor: crosshair; }
#fx, #sel, #imgc { pointer-events: none; }
/* yazı kalemi çubuğu: boşluk / alt satır / boy */
#writeBar { position: fixed; z-index: 30; display: flex; gap: 2px; background: var(--bar); border: 1px solid var(--border); border-radius: 9px; padding: 3px; box-shadow: 0 4px 14px var(--shadow); }
#writeBar .tool.mini { padding: 7px 10px; }
#wSize { cursor: ns-resize; touch-action: none; }

/* seçili resmin çubuğu: Kırp / Sil */
#imgBar { position: absolute; z-index: 6; display: flex; gap: 4px; background: var(--bar); border: 1px solid var(--border); border-radius: 9px; padding: 3px; box-shadow: 0 4px 14px var(--shadow); }
#imgBar .tool.mini { padding: 5px 9px; font-size: 12.5px; gap: 5px; }
#imgBar .tool.danger { color: var(--danger); }
#imgBar.cropping #imgCrop { background: var(--accent-soft); color: var(--accent); }
.mItem.danger { color: var(--danger); }

#textEditor {
  position: absolute; display: none; z-index: 5;
  min-width: 80px; min-height: 1.3em; padding: 2px 4px;
  border: 1px dashed var(--accent); border-radius: 4px;
  background: transparent; color: inherit; outline: none;
  font-family: system-ui, sans-serif; line-height: 1.25; resize: none;
  overflow: hidden; white-space: pre;
}

#uploadBar {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  background: var(--bar); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 16px; font-size: 13px;
  box-shadow: 0 2px 10px var(--shadow);
  display: none; z-index: 10;
}

/* ---------- İzinler ---------- */
#permBar {
  background: #fdf3e4; color: #8a5a17;
  border-bottom: 1px solid #efd9b0;
  padding: 7px 14px; font-size: 13px; text-align: center;
}
[data-theme="dark"] #permBar { background: #3b2f18; color: #ecc98a; border-color: #5c4a22; }
#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 130;
  max-width: min(560px, 92vw); padding: 10px 16px; border-radius: 10px;
  background: #23252e; color: #f4f4f2; font-size: 13.5px; line-height: 1.45;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .3);
}
.uBtn:disabled { opacity: .55; cursor: default; }
/* arama düğmesi: yeşil = katıl, kırmızı = ayrıl */
.callBtn.join { color: #1f9d55; }
.callBtn.join:hover { background: rgba(31, 157, 85, .12); }
.callBtn.leave { background: rgba(214, 60, 60, .12); color: #d63c3c; }
.callBtn.leave:hover { background: rgba(214, 60, 60, .2); }
.callBtn b { font-size: 13px; font-weight: 600; }
/* kişiler paneli satırları (izinler + arama durumu) */
.uRow .cIco { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--bg); color: var(--muted); }
.cIco.avatar { background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 700; }
.cIco.on { background: rgba(31, 157, 85, .14); color: #1f9d55; }
.cIco.off { background: rgba(214, 60, 60, .12); color: #d63c3c; }
.cIco.ring { background: var(--accent-soft); color: var(--accent); animation: ringPulse 1.2s ease-in-out infinite; }
.cBody { flex: 1; min-width: 0; }
.cName { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cName small { font-weight: 400; color: var(--muted); }
.cState { font-size: 12.5px; color: var(--muted); }
.uRow.out .cBody { opacity: .7; }
.uActs { display: flex; gap: 4px; flex-shrink: 0; }
.uActs .uBtn { padding: 6px 7px; }
/* gelen arama penceresi */
.modal.ring { text-align: center; padding: 26px 20px 20px; }
.ringIcon {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px;
  background: rgba(31, 157, 85, .14); color: #1f9d55;
  display: flex; align-items: center; justify-content: center;
  animation: ringPulse 1.2s ease-in-out infinite;
}
@keyframes ringPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.ringName { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.ringBtns { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.ringBtn { padding: 10px 18px !important; font-weight: 600 !important; border-radius: 999px !important; }
.ringBtn.accept { background: #1f9d55 !important; color: #fff !important; }
.ringBtn.decline { background: rgba(214, 60, 60, .12) !important; color: #d63c3c !important; }

#usersPanel {
  position: absolute; right: 12px; top: 60px; z-index: 20;
  width: 330px; max-height: 70vh; overflow: auto;
  background: var(--bar); color: var(--text);
  border: 1px solid var(--border); border-radius: 13px;
  box-shadow: 0 10px 32px var(--shadow);
  padding: 12px;
}
.uHead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 15px; }
.uAll { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.uAll .tool { font-size: 12.5px; padding: 8px 8px; border: 1px solid var(--border); justify-content: flex-start; gap: 6px; }
.uRow {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 4px; border-top: 1px solid var(--border);
}
.uName { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uBtn {
  font-size: 12px; font-family: inherit; padding: 5px 9px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text-2);
  display: flex; align-items: center; gap: 5px;
}
.uBtn.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.uEmpty { font-size: 12.5px; color: var(--muted); line-height: 1.5; padding: 4px 2px; }

/* Üst çubukta MİNİK kişi göstergeleri (Ramis 3.6): üst üste binen ufak daireler.
   Yeşil: aramada · turuncu: susturulmuş · yanıp sönen: çalıyor · gri: derste (aramada değil). */
#kisiSerit { display: flex; align-items: center; padding: 2px 3px; background: transparent; border: none; }
.kMini {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  background: var(--bg); color: var(--muted);
  border: 1.5px solid var(--bar); margin-left: -7px;
}
.kMini:first-child { margin-left: 0; }
.kMini.on { background: #1f9d55; color: #fff; }
.kMini.sus { background: #d68a2e; color: #fff; }
.kMini.cal { background: var(--accent-soft); color: var(--accent); animation: ringPulse 1.2s ease-in-out infinite; }
.kMini.artik { font-size: 9px; }
.kMini.bos { background: transparent; border-color: transparent; color: var(--muted); }

/* ================= Dar ekran (telefon / küçük tablet) düzeni =================
   Araç çubuğu 3 sıkı satıra oturur: 1) renkler+kalınlık  2) araçlar+geri/ileri
   3) sayfalar+arama+kişiler+ayarlar. Zoom düğmeleri gizli (iki parmakla
   yakınlaştırma var); "bağlı" yazısı yerine sadece nokta. */
@media (max-width: 700px), (max-height: 520px) {
  #toolbar { gap: 3px; row-gap: 6px; padding: 6px 10px 6px 48px; min-height: 0; } /* sol: sabit amblem payı */
  .tbBrk { display: block; flex-basis: 100%; height: 0; }
  .sep, #zoomGroup, .spacer, #statusText { display: none; }
  #status { padding-left: 0; margin-left: auto; }
  #logoMark { width: 24px; height: 24px; border-radius: 7px; margin-right: 0; }
  .iconbtn { width: 31px; height: 31px; }
  .iconbtn.wide { padding: 0 7px; gap: 4px; }
  button.tool svg, a.tool svg { width: 15px; height: 15px; }
  .swatch { width: 19px; height: 19px; }
  .swatchSep { margin: 0 1px; }
  #width { width: 86px; }
  #pageInput { width: 40px; font-size: 13px; }
  #pageTotal { font-size: 12px; padding: 0 1px; }
  #nav { gap: 1px; }
}

/* ---------- Telefonda "Altta" düzeni ---------- */
#toolbarB { display: none; }
@media (max-width: 700px), (max-height: 520px) {
  body.tbAlt #toolbarB {
    display: flex; align-items: center; gap: 4px;
    padding: 6px 8px; flex-shrink: 0;
    background: var(--bar); border-top: 1px solid var(--border);
    overflow-x: auto; /* sığmazsa yana kayar */
  }
  body.tbAlt #toolbar { flex-wrap: nowrap; overflow-x: auto; } /* üst şerit tek satır, gerekirse kayar */
  body.tbAlt .tbBrk { display: none; }
  body.tbAlt #status { margin-left: 0; }
}

/* ---------- Telefon düzenleri: Tek satır ve Yüzen; menüler yukarı açılma ---------- */
#fabBtn, #fabPanel, #logoMini { display: none; }

/* ---------- Üst çubuk amblemle küçülür/büyür — artık BİLGİSAYARDA da (Ramis 4.3/4.5) ----------
   Her ekranda TEK amblem vardır: sol üstteki SABİT mini amblem. Çubuğun kendi amblemi her
   yerde gizlidir — böylece çubuk kapanıp açılırken amblem hiç yerinden oynamaz ("biri yok
   olup diğeri geliyor" hissi olmaz); çubuk amblemin arkasında toplanır. Telefonda çubuk
   6 sn dokunulmayınca kendini gizler (3.4/3.5); bilgisayarda hep elle. Animasyon çubuğun
   GERÇEK yüksekliğinden başlar (--tbH'yi ayarlardaki kod ölçüp yazar) — 4.3'teki sabit
   180px tavan yüzünden "önce bekliyor sonra hızla kapanıyor" takılma hissi vardı (4.5).
   overflow yalnız geçişte ve kapalıyken gizlenir ki araç menüleri kırpılmasın. */
#toolbar #logoMark { display: none; }
#toolbar { padding-left: 50px; }
/* 4.7: aç/kapa animasyonu artık CSS geçişi değil, koddan yükseklik animasyonu (WAAPI) —
   bu kural yalnız KALICI kapalı hali tanımlar; animasyon bitince eklenir. */
body.ustKapali #toolbar {
  max-height: 0; padding-top: 0; padding-bottom: 0; min-height: 0;
  opacity: 0; border-bottom-width: 0; pointer-events: none; overflow: hidden;
}
#logoMini {
  display: flex;
  position: fixed; top: 6px; left: 8px; z-index: 30;
  width: 36px; height: 36px; border-radius: 10px; border: none; padding: 0;
  align-items: center; justify-content: center; cursor: pointer;
  background: transparent; opacity: .92;
  -webkit-tap-highlight-color: transparent;
}
/* amblem eski (çubuktaki) boyutunda — Ramis 4.6 */
#logoMini img { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 3px 10px rgba(0, 0, 0, .25); }
@media (max-width: 700px), (max-height: 520px) {
  /* Alt düzende ve yüzen palette seçenek menüleri YUKARI açılır (aşağıda yer yok) */
  body.tbAlt #toolbarB .menu.tmenu, body.tbFab #fabPanel .menu.tmenu { top: auto; bottom: calc(100% + 6px); }
  body.tbAlt #toolbarB [data-tip]:hover::after, body.tbFab #fabPanel [data-tip]:hover::after { top: auto; bottom: calc(100% + 8px); }

  /* Tek satır: her şey üstte tek şeritte, sığmayan yana kayar */
  body.tbTek #toolbar { flex-wrap: nowrap; overflow-x: auto; }
  body.tbTek .tbBrk { display: none; }
  body.tbTek #status { margin-left: 0; }

  /* Yüzen palet: üst şerit tek satır; araçlar köşedeki düğmeyle açılan palette */
  body.tbFab #toolbar { flex-wrap: nowrap; overflow-x: auto; }
  body.tbFab .tbBrk { display: none; }
  body.tbFab #status { margin-left: 0; }
  /* ---- Yüzen KAPSÜL: kalem | silgi | geri al | ⋯ — BALONCUK görünümü (Ramis'in kararı 3.0;
     ayrık yuvarlak düğmeler, seçili olan büyük ve seçili renk halkalı) ---- */
  body.tbFab #fabBtn {
    display: flex; align-items: center; gap: 5px;
    position: fixed; left: 12px; bottom: 14px; z-index: 32;
    height: 42px; border: none; padding: 0; background: transparent;
    cursor: pointer; touch-action: none;
  }
  .fabYuz {
    width: 31px; height: 31px; border-radius: 50%; flex: none;
    display: flex; align-items: center; justify-content: center; position: relative;
    background: var(--bar); color: var(--text);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .22); border: 1px solid var(--border);
  }
  .fabYuz.on {
    width: 38px; height: 38px; background: var(--accent); color: #fff; border: none;
    box-shadow: 0 0 0 2px var(--fabRenk, #1c1e26), 0 8px 20px rgba(28, 30, 38, .35);
  }
  #fabFaceMore { width: 25px; height: 25px; }
  /* Kalem HAPI: sol yarı normal/yazı kalemi, sağ yarı SOLAN kalem (Ramis 3.3) */
  .fabKalemHap {
    display: flex; align-items: center; flex: none; overflow: hidden;
    height: 33px; border-radius: 17px;
    background: var(--bar); border: 1px solid var(--border);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .22);
  }
  .fabKalemHap .fabYuz, .fabKalemHap .fabYuz.on {
    width: 31px; height: 33px; border-radius: 0;
    background: transparent; border: none; box-shadow: none; color: var(--text);
  }
  .fabKalemHap .fabYuz.on { background: var(--accent); color: #fff; }
  .fabKalemHap.on { box-shadow: 0 0 0 2px var(--fabRenk, #1c1e26), 0 8px 20px rgba(28, 30, 38, .35); }
  /* Baloncukların SIRASI bulunduğu köşeye göre (Ramis 3.4): hap hep köşeye yakın,
     kalanlar ekranın ortasına doğru uzanır — sağda sıra tersine döner, altta yukarı doğru */
  body.fabSag.tbFab #fabBtn { flex-direction: row-reverse; }
  /* kenara iyice sokulunca kapsül DİKEY kenetlenir; hap da dikey döner */
  body.fabDikey.tbFab #fabBtn { flex-direction: column; height: auto; width: 42px; justify-content: center; }
  body.fabDikey.fabAlt.tbFab #fabBtn { flex-direction: column-reverse; }
  body.fabDikey .fabKalemHap { flex-direction: column; height: auto; width: 33px; }
  body.fabDikey .fabKalemHap .fabYuz { width: 33px; height: 31px; }
  /* dokununca çıkan mavi vurgu karesi görüntüyü bozmasın */
  #fabBtn, #fabBtn .fabYuz { -webkit-tap-highlight-color: transparent; user-select: none; }
  #fabBtn:focus, #fabBtn:focus-visible { outline: none; }

  /* Üst çubuk telefonda kendini gizler (Ramis 3.4/3.5): 6 sn dokunulmayınca yumuşakça
     toplanır. Animasyon ve amblem kuralları genel blokta (yukarıda, 4.7: WAAPI). */

  /* Telefonda ayar paneli tüm ekranı kaplamasın; sayfanın bir kısmı görünür kalsın */
  #setPanel { width: 272px; max-width: 68vw; padding: 10px; }
  #setPanel .setRow { font-size: 13px; gap: 8px; }
  #setPanel .seg button { padding: 5px 7px; font-size: 12px; }
  body.tbFab.fabOpen #fabPanel {
    display: flex; flex-direction: column; gap: 8px;
    position: fixed; left: 12px; bottom: 70px; z-index: 32;
    background: var(--bar); border: 1px solid var(--border); border-radius: 14px;
    padding: 10px; box-shadow: 0 12px 34px var(--shadow);
    /* saçma büyük açılmasın: içerik kadar genişle, tavanı 320px; taşarsa içinde kaydır */
    width: max-content; max-width: min(92vw, 320px);
    max-height: calc(100dvh - 100px); overflow: auto;
  }
  #fabGroups { display: flex; flex-direction: column; gap: 8px; }
  #fabGroups .group { flex-wrap: wrap; }
}

/* Yüzen düğme: çizim sırasında yarı şeffaf (göz önünden çekilir) */
body.cizimde #fabBtn { opacity: .35; transition: opacity .2s; }
#fabBtn { transition: opacity .2s; }
