/* APKMobeAI — تحسينات الشكل والتوافق مع الأجهزة (إضافي: ما بيغيّرش الملفات الأصلية)
   بيتحمّل في: صفحات الألعاب + مقالات المدونة. الـ selectors مسبوقة بـ body علشان تكسب على الـ <style> الداخلي في القوالب. */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* ============ الألعاب ============ */
body .gx-wrap {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
body .gx-pills { -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
body .gx-pills a { min-height: 40px; display: inline-flex; align-items: center; scroll-snap-align: start; }
body .gx-search input { font-size: 16px; } /* 16px تمنع زوم iOS أوتوماتيك عند الكتابة */
body .gx-img { background: #1e3a8a; }
body .gx-card-t { overflow-wrap: anywhere; }

/* تركيز واضح للكيبورد والـ TV */
body .gx-card:focus-visible,
body .gx-pills a:focus-visible,
body .gx-play:focus-visible,
body .gx-bar button:focus-visible,
body .gx-share a:focus-visible,
body .gx-share button:focus-visible,
body .gx-search input:focus-visible {
  outline: 3px solid #0a84ff;
  outline-offset: 2px;
}

/* شاشات كبيرة: كروت أوسع شوية */
@media (min-width: 1024px) {
  body .gx-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
}
@media (min-width: 1500px) {
  body .gx-wrap { max-width: 1320px; }
}

/* موبايل */
@media (max-width: 640px) {
  body .gx-hero { padding: 20px 16px; border-radius: 18px; }
  body .gx-hero p { font-size: 13px; }
  body .gx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body .gx-h2, body .gx-sec-h h2 { font-size: 18px; }
  body .gx-bar { justify-content: center; }
}

/* الموبايل في الوضع الأفقي: اللعبة العمودية ما تتجاوزش الشاشة */
@media (orientation: landscape) and (max-height: 520px) {
  body .gx-player.gx-port { max-height: calc(100dvh - 24px); }
}

/* محتوى صفحة اللعبة */
body .gx-content { max-width: 880px; overflow-wrap: anywhere; }
body .gx-content img { max-width: 100%; height: auto; border-radius: 12px; }
body .gx-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
body .gx-content iframe { max-width: 100%; }
body .gx-content h2, body .gx-content h3 { scroll-margin-top: 84px; text-wrap: balance; }

/* ============ مقالات المدونة ============ */
body .sbl-body { text-rendering: optimizeLegibility; font-kerning: normal; overflow-wrap: break-word; }
body .sbl-body h2, body .sbl-body h3, body .sbl-body h4 { scroll-margin-top: 84px; text-wrap: balance; }
body .sbl-header h1 { text-wrap: balance; }
body .sbl-body pre { overflow-x: auto; -webkit-overflow-scrolling: touch; direction: ltr; text-align: left; }
body .sbl-body code { overflow-wrap: anywhere; }
body .sbl-body figure { margin: 18px 0; max-width: 100%; }
body .sbl-body figcaption { font-size: 13px; color: #64748b; text-align: center; margin-top: 6px; }
body .sbl-body iframe[src*="youtube"], body .sbl-body iframe[src*="youtu.be"] { width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: 14px; }
body .sbl-body a:focus-visible, body .sbl-breadcrumb a:focus-visible { outline: 3px solid #0a84ff; outline-offset: 2px; border-radius: 4px; }

@media (max-width: 640px) {
  body .sbl-outer { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  body .sbl-cover { aspect-ratio: 16 / 9; border-radius: 16px; }
  body .sbl-header h1 { line-height: 1.6; }
  body .sbl-body { line-height: 2; }
}
@media (min-width: 1024px) {
  body .sbl-body { font-size: 17px; line-height: 2.05; }
}

/* حركة أقل لمن يفضّلها */
@media (prefers-reduced-motion: reduce) {
  body .sbl-article { animation: none; }
  body .sbl-cover img, body .gx-card, body .gx-img { transition: none; }
  html { scroll-behavior: auto; }
}

/* طباعة المقال نظيفة */
@media print {
  body .gx-ad, body .gx-bar, body .gx-pills, body .gx-search { display: none !important; }
}
