/* ============================================
   Mobil uyum — tüm temalardan SONRA yüklenir.
   Inline grid'ler ve ana stilin !important kurallarını ezmek için
   seçiciler "html body[class]" ile başlar (özgüllük > body.ui ...).
   ============================================ */
@media (max-width: 720px) {
  html body[class] .pm-container {
    border-radius: 0 !important;
    border-left-width: 0 !important;
    border-right-width: 0 !important;
  }

  /* --- Topbar: ortadaki meta (gün/saat/isim) absolute-center yerine alt satıra --- */
  html body[class] .pm-topbar {
    flex-wrap: wrap !important;
    gap: 4px 8px !important;
    padding: 10px 12px 6px !important;
  }
  html body[class] .pm-topbar-actions {
    position: static !important;
    transform: none !important;
    order: 3 !important;
    width: 100% !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 4px 12px !important;
    white-space: normal !important;
  }
  html body[class] .pm-topbar-date,
  html body[class] .pm-topbar-right {
    gap: 2px !important;
  }
  html body[class] .pm-topbar [x-data] > div[x-show] {
    width: calc(100vw - 24px) !important;
    max-width: 320px !important;
  }

  /* --- Ana sekmeler: mobilde kaydırma yerine 2 satıra sar (4'erli). Tüm
     sekmeler görünür, kaydırma yok → ekran okuyucu dostu. --- */
  html body[class] .nav-tabs {
    margin: 0 12px 10px !important;
    flex-wrap: wrap !important;
    overflow: hidden !important;
  }
  html body[class] .nav-tab {
    flex: 1 0 25% !important;
    max-width: 25% !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    padding: 8px 4px !important;
    font-size: 12px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
  }

  /* --- İçerik + sağ menü: tek kolon, menü içeriğin altına --- */
  html body[class] .pm-container div[style*="grid-template-columns: 1fr 220px"],
  html body[class] .pm-container div[style*="grid-template-columns:1fr 280px"],
  html body[class] .pm-container div[style*="grid-template-columns: 200px 1fr"] {
    grid-template-columns: minmax(0, 1fr) !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  /* V1 karakter paneli 3-kolon istatistikler */
  html body[class] .pm-container div[style*="grid-template-columns: 1.1fr 0.95fr 0.95fr"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* --- İstatistikler grid'i: sabit etiket kolonları (90px/64px) mobilde
     sağ kolonu ekrandan taşırıyor. Etiketleri auto yapıp değerleri sola
     yaklaştır, boşluk/padding'i kıs, fontu biraz küçült → 3 kolon sığsın. --- */
  html body[class] .ui-stats {
    padding: 9px 12px !important;
    column-gap: 10px !important;
    font-size: 12px !important;
  }
  html body[class] .ui-stats .ui-row {
    grid-template-columns: auto minmax(0, 1fr) !important;
    column-gap: 5px !important;
    font-size: 12px !important;
    min-width: 0 !important;
  }
  /* Bar satırlarında etiket SABİT genişlik — yoksa "Mutluluk:" uzun olduğu için
     o satırın barı daralıp "100 / 100" sayısı kesiliyor; sabitle barlar eşit/hizalı. */
  html body[class] .ui-stats .ui-bar-row {
    grid-template-columns: 60px minmax(0, 1fr) !important;
    column-gap: 5px !important;
    font-size: 12px !important;
    min-width: 0 !important;
  }
  html body[class] .ui-stats .ui-row .val,
  html body[class] .ui-stats .ui-row .lbl {
    min-width: 0 !important;
  }
  /* Para ve diğer kolon-atamalı satırlar da aynı dar şablonu kullansın */
  html body[class] .ui-stats .ui-row.money {
    grid-template-columns: auto minmax(0, 1fr) !important;
    column-gap: 5px !important;
  }

  /* Bar üstü sayılar ("100 / 100") mobilde dar barda sığmıyor → küçült. */
  html body[class] .ui-stats .ui-bar .num {
    font-size: 9px !important;
    padding-right: 4px !important;
  }

  /* Son Giriş "Online": mobilde "Online" yazısı yerine mesaj başlığındaki
     gibi halkalı yuvarlak yeşil nokta göster. Yazıyı gizle (font-size:0 DEĞİL;
     o ::before dikey hizasını bozuyordu), ::before'u nokta yap. */
  html body[class] .ui-stats .ui-online .ui-online-t {
    display: none !important;
  }
  html body[class] .ui-stats .ui-online:not(.ui-online--mobile)::before {
    content: "" !important;
    display: inline-block !important;
    width: 9px !important;
    height: 9px !important;
    border-radius: 50% !important;
    background: #5fae37 !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45) !important;
    margin: 0 !important;
    vertical-align: middle !important;
  }

  html body[class] .pm-flash-wrap { margin-left: 12px; margin-right: 12px; }

  /* Geniş tablolar paneli taşırmasın */
  html body[class] .panel-body { overflow-x: auto; }

  /* --- Ek: diğer içerik+yan menü / sabit kolon düzenleri → tek kolon --- */
  html body[class] .pm-container div[style*="grid-template-columns: 1fr 280px"],
  html body[class] .pm-container div[style*="grid-template-columns:1fr 280px"],
  html body[class] .pm-container div[style*="grid-template-columns: 1fr 240px"],
  html body[class] .pm-container div[style*="grid-template-columns: 240px 1fr"],
  html body[class] .pm-container div[style*="grid-template-columns: 120px 1fr"],
  html body[class] .pm-container div[style*="grid-template-columns: 110px 1fr"],
  html body[class] .pm-container div[style*="grid-template-columns: 60px 1fr 2fr"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* --- Kart gridleri: 3-4 kolon → 2 kolon --- */
  html body[class] .pm-container div[style*="grid-template-columns: 1fr 1fr 1fr 1fr"],
  html body[class] .pm-container div[style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* --- Form kontrolleri taşmasın --- */
  html body[class] .panel-body input,
  html body[class] .panel-body textarea,
  html body[class] .panel-body select {
    max-width: 100% !important;
    box-sizing: border-box;
  }
}

/* === Çok dar ekranlar (telefon dikey, <=480px) === */
@media (max-width: 480px) {
  /* 2 kolonlu inline gridler → tek kolon */
  html body[class] .pm-container div[style*="grid-template-columns: 1fr 1fr"],
  html body[class] .pm-container div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  /* Sekmeler biraz daha sıkı (4'erli wrap'te "Sıralamalar" taşmasın) */
  html body[class] .nav-tab { padding: 7px 3px !important; font-size: 11px !important; }
  /* Panel başlıkları taşmasın */
  html body[class] .panel-header { font-size: 12px !important; }
}

/* ============================================
   Mobil üst menü stilleri (Görüntü Ayarları → Mobil Menü; body.mnav-grid|scroll|bottom)
   Masaüstünde simgeler ve "Daha" düğmesi gizli; menü eskisi gibi.
   ============================================ */
.nav-tabs .nt-ico { display: none; }
html body[class] .nav-tabs .nt-morebtn,
html body[class] .nav-tabs .nt-morebox { display: none !important; }

@media (max-width: 720px) {
  .nav-tabs .nt-ico { width: 18px; height: 18px; flex-shrink: 0; }

  /* C — Izgara (varsayılan): ilk hâli — yukarıdaki 4'erli iki satır kuralı aynen geçerli, simge yok */

  /* A — Kaydırmalı tek satır: sekmelerin görünüşü aynı (masaüstündeki gibi), yalnız tek satır + yatay kaydırma */
  html body.mnav-scroll[class] .nav-tabs {
    position: relative !important; flex-wrap: nowrap !important; overflow-x: auto !important; overflow-y: hidden !important;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  html body.mnav-scroll[class] .nav-tabs::-webkit-scrollbar { display: none; }
  html body.mnav-scroll[class] .nav-tab {
    flex: 0 0 auto !important; max-width: none !important; padding: 9px 14px !important; font-size: 12px !important;
    border-bottom: 0 !important;
  }

  /* B — Alt sekme çubuğu: ekranın altına sabit; 4 sekme + "Daha" */
  html body.mnav-bottom[class] { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)) !important; }
  html body.mnav-bottom[class] .nav-tabs {
    position: fixed !important; left: 0; right: 0; bottom: 0; z-index: 900;
    margin: 0 !important; border-radius: 0 !important; overflow: visible !important;
    display: grid !important; grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    box-shadow: 0 -2px 10px rgba(10, 30, 40, .15) !important;
  }
  html body.mnav-bottom[class] .nav-tab.nt-x { display: none !important; }
  html body.mnav-bottom[class] .nav-tab,
  html body.mnav-bottom[class] .nav-tabs .nt-morebtn {
    display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important;
    gap: 2px !important; max-width: none !important; padding: 7px 2px 6px !important; font-size: 11px !important; line-height: 1.2 !important;
    border: 0 !important; border-radius: 0 !important; background: transparent; font-family: inherit; cursor: pointer; color: inherit;
  }
  html body.mnav-bottom[class] .nav-tab .nt-ico { display: block; width: 20px; height: 20px; }
  html body.mnav-bottom[class] .nav-tabs .nt-morebox:not([hidden]) {
    display: flex !important; flex-direction: column; position: absolute; right: 8px; bottom: calc(100% + 6px); min-width: 180px;
    background: var(--ui-card, #fff); border: 1px solid var(--ui-card-edge-soft, #cfe4ec); border-radius: 8px;
    box-shadow: 0 6px 24px rgba(10, 30, 40, .22); padding: 4px; z-index: 901;
  }
  html body.mnav-bottom[class] .nt-morebox a {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; font-size: 12px;
    color: var(--ui-ink, #1b3139); text-decoration: none;
  }
  html body.mnav-bottom[class] .nt-morebox a .nt-ico { display: block; }
  html body.mnav-bottom[class] .nt-morebox a.active { color: var(--ui-hdr-bot, #2c6a80); font-weight: 600; background: var(--ui-card-alt, #eef6f8); }
}

/* Karakter / profil paneli (mobil): beyanat balonu avatarın altındaki boş alanı da kullanır, tam genişlik */
@media (max-width: 720px) {
  html body[class] .cp-hero { display: grid !important; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; row-gap: 12px; align-items: start; }
  html body[class] .cp-hero > .cp-hero-text { display: contents; }
  html body[class] .cp-hero > .cp-hero-text > * { grid-column: 2; min-width: 0; }
  html body[class] .cp-hero > .cp-hero-text > .speech-bubble { grid-column: 1 / -1; margin: 0 !important; }
  /* Balonun oku yukarıyı (avatarı) gösterir */
  html body[class] .cp-hero .speech-bubble::before {
    left: 28px; top: -8px;
    border-top: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 8px solid #c0d1de;
  }
  html body[class] .cp-hero .speech-bubble::after { display: none; }
  html body[class] .cp-hero > .cp-hero-text > p.pp-intro:last-of-type,
  html body[class] .cp-hero .pp-intro-wrap > p.pp-intro:last-child { margin-bottom: 0 !important; }
}

/* Forum başlık çubuğu (mobil): 2 satır — (isim | #no tarih) / (forum mesajı | simgeler + yanıtla + mod) */
@media (max-width: 680px) {
  html body[class] .ui-post-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name meta" "count acts";
    align-items: center;
    column-gap: 10px;
    row-gap: 3px;
    padding: 7px 10px 6px 12px;
  }
  html body[class] .ui-post-bar .ui-pb-left,
  html body[class] .ui-post-bar .ui-pb-right { display: contents; }
  html body[class] .ui-post-bar .ui-pb-left > :first-child { grid-area: name; min-width: 0; }
  html body[class] .ui-post-bar .ui-pb-postcount { grid-area: count; }
  html body[class] .ui-post-bar .ui-pb-meta { grid-area: meta; display: flex; align-items: center; gap: 7px; justify-self: end; white-space: nowrap; }
  html body[class] .ui-post-bar .ui-pb-acts { grid-area: acts; display: flex; align-items: center; gap: 2px; justify-self: end; }
  /* Yanıtla: mobilde kalp/yıldız/bayrak ile aynı tarzda çerçevesiz simge */
  html body[class] .ui-post-bar .ui-quote-btn .rp-txt, html body[class] .ui-post-bar .ui-mod-btn .rp-txt { display: none; }
  html body[class] .ui-post-bar .ui-quote-btn .rp-ico, html body[class] .ui-post-bar .ui-mod-btn .rp-ico { display: block; }
  html body[class] .ui-post-bar .ui-quote-btn, html body[class] .ui-post-bar .ui-mod-btn {
    width: 22px; min-width: 22px; height: 22px; padding: 0 !important; border: 0 !important; border-radius: 11px;
    background: transparent !important; box-shadow: none !important; justify-content: center;
    color: rgba(255, 255, 255, 0.88);
  }
  html body[class] .ui-post-bar .ui-quote-btn:hover, html body[class] .ui-post-bar .ui-mod-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.14) !important; }
  html body[class] .ui-post.is-authority .ui-post-bar .ui-quote-btn, html body[class] .ui-post.is-authority .ui-post-bar .ui-mod-btn { color: #8a7320; }
}
