/* Mobil düzen (≤ 768 px): alt gezinme çubuğu, ≥ 44 px dokunma hedefleri, tablolarda yatay kaydırma, kart görünümlü tablolar.
   Masaüstü (> 768 px) görünümüne dokunmaz. Son yüklenen stil dosyasıdır. */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  main { padding: 12px 12px 24px; }

  /* üst çubuk: marka + piyasa + hesap; sekmeler alta taşınır */
  .topbar { padding: 8px 12px; gap: 8px; backdrop-filter: none; background: var(--bg); }
  .brand span:not(.market-badge) { font-size: 15px; }
  .market-switch { order: 3; }
  .acct { margin-left: auto; }
  .acct-nm { display: none; }
  .acct-btn { padding: 4px; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; width: 100%; max-width: 100vw; margin: 0; gap: 2px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(11, 15, 23, .97); border-top: 1px solid var(--line); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; min-width: 76px; min-height: 48px; padding: 6px 12px; font-size: 13px; }

  /* dokunma hedefleri */
  .btn, .btn-primary, button.chip, .linklike, select, .acct-btn, .acct-menu button { min-height: 44px; }
  .btn.small, .btn.ghost.small { min-height: 44px; padding: 8px 14px; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]) { min-height: 44px; font-size: 16px; }
  select, textarea { font-size: 16px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  label.inline { min-height: 44px; }
  .market-switch button { min-height: 44px; min-width: 56px; }

  /* tablolar: yatay kaydırma (ilk sütun yapışık kalmaz; dokunmayla akıcı) */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* kart görünümlü tablolar (class="cards-m"): satır = kart, hücre = "etiket: değer" */
  table.cards-m, table.cards-m tbody, table.cards-m tr, table.cards-m td { display: block; width: 100%; min-width: 0; }
  .table-wrap table.cards-m { min-width: 0; }
  table.cards-m thead { display: none; }
  table.cards-m tr { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
  table.cards-m td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  table.cards-m td::before { content: attr(data-l); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; flex: 0 0 auto; }
  table.cards-m td.us-act { justify-content: flex-end; flex-wrap: wrap; }
  table.cards-m td.us-act::before { content: none; }
  table.cards-m tr.empty td::before { content: none; }

  /* kaydırma kabı olmayan tablolar ve kod blokları sayfayı taşırmasın */
  .view table:not(.cards-m) { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .view pre, .view img { max-width: 100%; overflow-x: auto; }
  .help-layout { grid-template-columns: 1fr; }
  .help-body, .help-toc { min-width: 0; overflow-wrap: anywhere; }

  .legal-foot { padding: 0 12px 16px; }
  .auth-card { padding: 18px; }
  .acct-menu { position: fixed; right: 12px; top: 56px; }
  /* uygulama indirme düğmesi ve paneli: kısa etiket, tam genişlik panel (taşma yok), 44 px hedefler */
  .dl { margin-left: auto; }
  .dl + .acct { margin-left: 0; }
  .dl-lbl { display: none; }
  .dl-lbl-s { display: inline; }
  .dl-btn { min-height: 44px; min-width: 44px; justify-content: center; padding: 8px 12px; }
  .dl-menu { position: fixed; left: 12px; right: 12px; top: 56px; width: auto; max-width: none; max-height: calc(100vh - 160px); overflow-y: auto; }
  .dl-get { min-height: 44px; }
  .dl-x { min-height: 44px; min-width: 44px; }
  .update-banner { padding: 8px 12px; }
  dialog { max-width: calc(100vw - 16px); }

  /* v5-G: alt çubukta ana sekmeler + etkin sekme + "Daha fazla" (app.js TAB_MAIN) */
  .tabs .tab[data-view]:not(#tab-scan):not(#tab-universe):not(#tab-fund):not(.active) { display: none; }
  .tab-more-btn { display: inline-flex; align-items: center; justify-content: center; margin-left: auto; }
  .tab-more-btn[aria-expanded="true"] { color: var(--text); background: var(--panel2); }
  .tabs { overflow-x: hidden; }
  .tab { min-width: 0; flex: 1 1 0; padding: 6px 6px; }

  /* üst çubuk: hisse araması simge düğmesiyle açılır (tam genişlik satır) */
  .gsearch { display: none; }
  .gsearch-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; color: var(--text); cursor: pointer; }
  body.gsearch-open .gsearch { display: flex; order: 10; flex: 1 1 100%; }
  body.gsearch-open .gsearch input { width: 100%; }
  body.gsearch-open .gsearch-btn { border-color: var(--accent); }
  .brand svg { width: 22px; height: 22px; }

  /* Tara: veri bandı kısa, strateji çipleri tek satır yatay kaydırma, filtreler sıkı */
  .scan-hero { gap: 8px; padding: 12px; }
  .data-banner { font-size: 12px; padding: 6px 10px; }
  .results { padding: 12px 10px; }
  .results-head { gap: 8px; }
  .filters { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
  .filters label.inline { flex: 1 1 auto; }
  .res-q { flex: 1 1 140px; width: auto; }
  .sort-m { display: inline-flex; }
  #strategy-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 4px -10px 8px; padding: 0 10px; }
  #strategy-chips::-webkit-scrollbar { display: none; }
  #strategy-chips .chip { flex: 0 0 auto; }
  .wl-x { width: 44px; height: 44px; }
  .wl-chip { padding-left: 12px; }
  .star { min-width: 44px; min-height: 44px; }
  .pv-links .btn { flex: 1 1 140px; }
}

@media (max-width: 640px) {
  /* Tara sonuçları: kart benzeri satır — sembol+ad+ilk sinyal | fiyat/% | büyük skor; yatay kaydırma yok */
  #results-table { display: table; table-layout: fixed; width: 100%; }
  #results-table thead { display: none; }
  #results-table td { padding: 8px 4px; vertical-align: middle; white-space: normal; }
  #results-table td.st { width: 44px; padding: 0; }
  #results-table td.cb { width: 36px; }
  #results-table td:nth-child(4) { width: auto; overflow: hidden; }
  #results-table td.num { width: 84px; }
  #results-table td.num:last-child { width: 58px; }
  #results-table .score { min-width: 46px; font-size: 17px; padding: 6px 6px; }
  #results-table .lab-hist { display: none; }
  #results-table .sig-m { display: block; font-size: 11px; color: var(--blue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #results-table td .nm { max-width: 100%; white-space: nowrap; }
  #results-table .tag { margin-left: 4px; }
  #results-table tr.empty td { padding: 20px 8px; }
  .min-score-l { display: none; }
  /* filtre satırı: Göster ve Sırala yan yana (etiket metni yalnız ekran okuyucuya), arama tam genişlik */
  .filters label.inline { flex: 1 1 45%; font-size: 0; gap: 0; }
  .filters label.inline select { flex: 1 1 auto; width: 100%; font-size: 15px; }
  .res-q { order: 3; flex: 1 1 100%; }
  /* uzun bilgi satırları iki satıra katlanır; dokununca açılır (app.js .clamp) */
  .data-banner, .diff-line { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
  .data-banner, .diff-line { line-height: 1.4em; max-height: calc(2.8em + 14px); }
  .data-banner.open, .diff-line.open { display: block; max-height: none; }
}
