/* Terman's own browser — full-bleed view that replaces the panes host when
   the user picks "Browser" in the sidebar. Lives at workspace grid-row 2
   alongside .panes-host, .agent-network and .workflow; toggled via
   body[data-view].

   Layout note: the picture must never scroll the page. The stage is the only
   flexible row, the image is object-fit:contain inside it, and every
   coordinate the JS sends is normalised to the IMAGE's box — so letterboxing
   is free rather than a source of off-by-forty-pixel clicks. */

.tarayici {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.tarayici[hidden] { display: none; }

/* The .workspace grid declares only two rows and relies on exactly one row-2
   child being visible. With a FOURTH child every other one must be hidden or
   the grid grows an implicit row and the layout shifts. */
body[data-view="tarayici"] .panes-host,
body[data-view="tarayici"] .agent-network,
body[data-view="tarayici"] .workflow { display: none; }
body[data-view="tarayici"] .tabs-host { visibility: hidden; }
body[data-view="tarayici"] #claude-toggles,
body[data-view="tarayici"] #voice-indicator,
body[data-view="tarayici"] #new-tab-btn,
body[data-view="tarayici"] #reconnect-btn { display: none; }

/* ---- tab strip --------------------------------------------------------- */
.tarayici__ust {
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 6px 8px 0;
  border-bottom: 1px solid var(--border, #232833);
  background: var(--panel, #12151c);
  flex: 0 0 auto;
  min-height: 0;
}
.tarayici__sekmeler {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  flex: 1 1 auto;
  min-width: 0;
}
.tarayici__sekme {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  max-width: 200px;
  padding: 7px 10px;
  border: 1px solid var(--border, #232833);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted, #93a0b8);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}
.tarayici__sekme:hover { background: rgba(255, 255, 255, 0.04); }
.tarayici__sekme.is-active {
  background: var(--bg, #0c0f14);
  color: var(--text, #e8ecf4);
  border-color: var(--accent, #7c8cff);
}
.tarayici__sekme-ad { overflow: hidden; text-overflow: ellipsis; }
.tarayici__sekme-kapat {
  opacity: 0.45;
  font-size: 11px;
  padding: 0 2px;
  border-radius: 4px;
}
.tarayici__sekme-kapat:hover { opacity: 1; background: rgba(255, 255, 255, 0.1); }
.tarayici__yenisekme {
  flex: 0 0 auto;
  width: 30px;
  border: 1px solid var(--border, #232833);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted, #93a0b8);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.tarayici__yenisekme:hover { background: rgba(255, 255, 255, 0.06); color: var(--text, #e8ecf4); }

/* ---- toolbar ----------------------------------------------------------- */
.tarayici__arac {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #232833);
  background: var(--panel, #12151c);
  flex: 0 0 auto;
}
.tarayici__dugme {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid var(--border, #232833);
  border-radius: 8px;
  background: transparent;
  color: var(--text, #e8ecf4);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.tarayici__dugme:hover { background: rgba(255, 255, 255, 0.06); }

/* ---- ikonlar ----------------------------------------------------------
   Araç çubuğu 4 Eyl'de emojiden çizgi ikona geçti (scripts/ikonlar.js).
   Düğmelerin içi artık bir metin düğümü değil bir <svg>, o yüzden ortalama
   satır yüksekliğiyle değil ızgarayla yapılıyor: emojide düğmeden düğmeye
   değişen o yarım piksellik kayma buradan geliyordu.

   Boyut TEK yerde: ikon rengini `currentColor`dan alıyor, yani :hover,
   .is-active ve tema değişimi için ayrı bir kural gerekmiyor. */
.tarayici__dugme,
.tarayici__yenisekme,
.tarayici__sekme-kapat {
  display: grid;
  place-items: center;
}
.tarayici__dugme svg,
.tarayici__yenisekme svg { width: 17px; height: 17px; display: block; }
.tarayici__sekme-kapat svg { width: 12px; height: 12px; display: block; }
.tarayici__adres {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border, #232833);
  border-radius: 15px;
  background: var(--bg, #0c0f14);
  color: var(--text, #e8ecf4);
  font: inherit;
  font-size: 13px;
}
.tarayici__adres:focus {
  outline: none;
  border-color: var(--accent, #7c8cff);
}
.tarayici__rozet {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted, #93a0b8);
  padding: 3px 8px;
  border: 1px solid var(--border, #232833);
  border-radius: 999px;
}
.tarayici__rozet:empty { display: none; }

/* ---- the picture ------------------------------------------------------- */
.tarayici__sahne {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #05070a;
}
.tarayici__kare {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  /* The page inside handles its own scrolling and text selection; letting the
     host page do either turns a drag into a selection instead of a drag. */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  cursor: default;
}
.tarayici__kare:not([src]) { visibility: hidden; }

.tarayici__perde {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 7, 10, 0.88);
  text-align: center;
  padding: 24px;
}
.tarayici__perde[hidden] { display: none; }
.tarayici__perde-baslik {
  font-size: 15px;
  color: var(--text, #e8ecf4);
  margin-bottom: 6px;
}
.tarayici__perde-metin {
  font-size: 13px;
  color: var(--muted, #93a0b8);
  margin: 0 0 14px;
  max-width: 42ch;
}
.tarayici__perde-metin.is-hata { color: #f4b8b8; }

/* Off screen rather than display:none — a focused input is the only thing
   that raises the phone keyboard, and a hidden element cannot take focus. */
.tarayici__klavye {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  padding: 0;
  resize: none;
}

/* ---- phone ------------------------------------------------------------- */
@media (max-width: 720px) {
  .tarayici__ust { padding: 4px 4px 0; }
  .tarayici__sekme { max-width: 130px; padding: 8px 8px; }
  .tarayici__arac { padding: 6px; gap: 4px; }
  .tarayici__dugme { width: 34px; height: 34px; }
  /* Dokunma boyunda ikon da büyür: 34'lük bir düğmenin ortasındaki 17px'lik
     ikon, düğmeyi boş gösteriyor. */
  .tarayici__dugme svg,
  .tarayici__yenisekme svg { width: 19px; height: 19px; }
  .tarayici__sekme-kapat svg { width: 13px; height: 13px; }
  .tarayici__adres { height: 34px; font-size: 16px; }  /* 16px: iOS zooms below it */
  .tarayici__rozet { display: none; }
}

/* ---- telefonun kendi tarayıcısı ---------------------------------------
   APK'nın içinde sahne bir RESİM değil, bir DELİK: arkasına uygulamanın
   kendi WebView'i (gerçek tarayıcı) native olarak oturuyor. O yüzden zemin
   şeffaf ve sahne dokunuşları yakalamıyor — dokunuş, altındaki gerçek
   sayfaya gitmeli. Perde (sekme yokken çıkan yazı) yine tıklanabilir. */
.tarayici__sahne--yerel {
  background: transparent;
  pointer-events: none;
}
.tarayici__sahne--yerel .tarayici__perde {
  pointer-events: auto;
  background: rgba(5, 7, 10, 0.92);
}
.tarayici__dugme.is-active {
  color: var(--text, #e8ecf4);
  border-color: var(--accent, #4f8cff);
}

/* ---- delik: sayfa ÜSTTE, gerçek tarayıcı ALTTA -------------------------
   4 Eyl'e kadar native tarayıcı katmanı sayfanın üstüne ekleniyordu ve orb
   onun altında kalıyordu (Mira: "'Jervis' browser'ın altında kalıyor …
   'Jervis'i göremiyorum"). Sayfadaki hiçbir z-index bunu çözemez: iki katman
   aynı boyama ağacında değil.

   Sıra ters çevrildi. Şimdi tarayıcı ALTTA duruyor ve sayfa onun üstünde;
   sahnenin görünebilmesi için de zemin zincirinin TAMAMI o an şeffaf olmak
   zorunda — body → .app → .workspace → .tarayici. Native kök zaten aynı
   rengi (#0b0d12 = --bg) boyadığı için tek görünür fark .app'in radyal
   parıltısının o an kaybolması; kenar çubuğu ve başlık kendi zeminlerini
   taşıdığı için onlar aynı kalıyor.

   Sınıf yalnız GÖSTERİLECEK bir sekme varken duruyor (telefon-tarayici.js
   → _ciz), yani boş bir panelde çalışma alanı normal zeminiyle kalıyor. */
body.telefon-delik,
body.telefon-delik .app,
body.telefon-delik .workspace,
body.telefon-delik .tarayici { background: transparent; }

/* ---- eklenti çekmecesi ------------------------------------------------- */
.tarayici__eklenti {
  border-bottom: 1px solid var(--border, #232833);
  background: var(--panel, #12151c);
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 44vh;
  overflow-y: auto;
}
.tarayici__eklenti[hidden] { display: none; }
.tarayici__satir {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.tarayici__satir b {
  margin-left: auto;
  font-weight: 500;
  font-size: 11.5px;
  color: var(--muted, #8b93a7);
}
.tarayici__ekle { display: flex; gap: 6px; }
.tarayici__ekle .tarayici__adres { flex: 1 1 auto; min-width: 0; }
.tarayici__ipucu {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted, #8b93a7);
}
.tarayici__soru,
.tarayici__eklentiSatir {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--border, #232833);
  font-size: 13px;
}
.tarayici__eklentiSatir.is-kapali { opacity: 0.5; }
.tarayici__eklentiAd {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tarayici__eklentiAd i,
.tarayici__eklentiAd em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted, #8b93a7);
}
.tarayici__eklentiAd em { color: var(--warn, #e0b93c); }
.tarayici__sonuc { margin: 0; font-size: 12px; }
.tarayici__sonuc.is-ok { color: var(--ok, #5ee2a0); }
.tarayici__sonuc.is-hata { color: var(--err, #ff6b6b); }
