/* 3.5.12 - פריסת דסקטופ לעמוד משחק (body.wg-game-layout).
   הסלקטורים מתחילים ב-html body כדי לגבור על ה-CSS הנוסף של וורדפרס. */

/* עד 1099: העטיפות החדשות שקופות, והעמוד נראה כמו קודם */
.wgl-lower, .wgl-main, .wgl-card { display: contents; }
.sg-col-promo, .wgl-side, .wgl-rail-search { display: none; }
.sg-similar-grid .wg-extra, .sg-similar-title .wg-title-d { display: none; }

@media (min-width: 1100px) {
  /* ===== תפריט: סגור 48, פתוח 220 מעל העמוד ===== */
  html body.wg-game-layout #otv-content-wrap { margin-right: 48px; width: calc(100% - 48px); }
  html body.wg-game-layout #otv-sidebar { min-width: 0; }
  html body.wg-game-layout #otv-sidebar .sb-section { flex-shrink: 0; }
  html body.wg-game-layout #otv-sidebar.wgl-open { width: 220px; box-shadow: -10px 0 30px rgba(0,0,0,.18); }

  html body.wg-game-layout #otv-sidebar:not(.wgl-open) { width: 48px; scrollbar-width: none; }
  html body.wg-game-layout #otv-sidebar:not(.wgl-open)::-webkit-scrollbar { display: none; }
  html body.wg-game-layout #otv-sidebar:not(.wgl-open) .sb-logo-link { padding: 8px 2px; }
  html body.wg-game-layout #otv-sidebar:not(.wgl-open) .sb-logo-img { width: 44px; max-width: 44px; height: auto; }
  html body.wg-game-layout #otv-sidebar:not(.wgl-open) .sb-search-wrap,
  html body.wg-game-layout #otv-sidebar:not(.wgl-open) .sb-section-title,
  html body.wg-game-layout #otv-sidebar:not(.wgl-open) .sb-count { display: none; }
  html body.wg-game-layout #otv-sidebar:not(.wgl-open) .sb-item { position: relative; justify-content: center; gap: 0; min-height: 40px; padding: 8px 0; border-right-width: 2px; border-left: 2px solid transparent; }
  html body.wg-game-layout #otv-sidebar:not(.wgl-open) .sb-icon { width: auto; font-size: 20px; line-height: 1.2; }
  /* מוסתר חזותית בלבד - הטקסט נשאר בקישור */
  html body.wg-game-layout #otv-sidebar:not(.wgl-open) .sb-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html body.wg-game-layout #otv-sidebar:not(.wgl-open) .wgl-rail-search { display: flex; flex-shrink: 0; align-items: center; justify-content: center; height: 42px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: #5c6bc0; cursor: pointer; }

  /* ===== מסך ראשון: [פרסומת גבוהה] [משחק] [פרסומת גבוהה] ===== */
  html body.wg-game-layout .sg-above {
    display: grid; grid-template-columns: minmax(0, 1fr) 160px !important; grid-template-rows: auto;
    column-gap: 30px !important; row-gap: 0; margin: 0; padding: 0 11px; width: 100%; height: auto; max-height: none;
  }
  html body.wg-game-layout .sg-above > .sg-col-left { display: none; }
  html body.wg-game-layout .sg-col-game { grid-column: 1; grid-row: 1; }
  html body.wg-game-layout .sg-col-right { grid-column: 2; grid-row: 1; padding: 10px 0; background: transparent; border: 0; }
  html body.wg-game-layout .sg-above.wg-has-promo { grid-template-columns: 160px minmax(0, 1fr) 160px !important; }
  html body.wg-game-layout .sg-above.wg-has-promo .sg-col-promo { display: block; grid-column: 1; grid-row: 1; align-self: start; min-width: 0; padding: 10px 0; }
  html body.wg-game-layout .sg-above.wg-has-promo .sg-col-game { grid-column: 2; }
  html body.wg-game-layout .sg-above.wg-has-promo .sg-col-right { grid-column: 3; }
  html body.wg-game-layout .sg-col-promo > .otv-ad-slot { display: block; width: 100%; margin: 0; content-visibility: visible; }

  /* פס הלייקים */
  html body.wg-game-layout .sg-game-bar { flex-wrap: wrap; row-gap: 6px; }
  html body.wg-game-layout .sg-game-bar-actions { flex-wrap: wrap; row-gap: 6px; }

  /* ===== מתחת למשחק: [קופסת תוכן + בלוק קטגוריה] [תמונה, פרסומת, מומלצים] ===== */
  html body.wg-game-layout #sg-below-section { display: block !important; max-width: none; margin: 0; padding: 24px 16px 40px !important; }
  html body.wg-game-layout .wgl-lower { display: grid; grid-template-columns: minmax(0, 1fr) 312px; column-gap: 16px; align-items: start; max-width: 1200px; margin: 0 auto; direction: rtl; }
  html body.wg-game-layout .wgl-main { display: block; min-width: 0; }
  html body.wg-game-layout .wgl-card { display: block; background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
  html body.wg-game-layout .wgl-card .sg-breadcrumb { margin-bottom: 16px; }
  html body.wg-game-layout .wgl-card .sg-info-row-main { grid-template-columns: minmax(0, 1fr) !important; margin-bottom: 20px; }
  html body.wg-game-layout .wgl-card .sg-info-thumb-wrap { display: none; }
  html body.wg-game-layout .wgl-card .sg-details { margin-bottom: 0; }
  html body.wg-game-layout .wgl-card .wgm-game { margin: 16px 0 0; }

  html body.wg-game-layout .wgl-main .sg-similar-section { margin-top: 24px; }
  html body.wg-game-layout .sg-similar-title .wg-title-m { display: none; }
  html body.wg-game-layout .sg-similar-title .wg-title-d { display: inline; }
  html body.wg-game-layout .wgl-main .sg-similar-grid { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; gap: 10px; }
  html body.wg-game-layout .sg-similar-grid .wg-extra { display: block; }
  html body.wg-game-layout .wgl-main .sg-sim-card { border-radius: 12px; }
  html body.wg-game-layout .wgl-main .sg-sim-name,
  html body.wg-game-layout .wgl-rec-grid span {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal;
    height: 2.6em; line-height: 1.3; margin: 5px 3px; padding: 0; text-align: center; font-size: .72rem; font-weight: 600; color: var(--text-dark);
  }

  html body.wg-game-layout .wgl-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  html body.wg-game-layout .wgl-thumb { display: flex; flex-direction: column; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 10px; }
  html body.wg-game-layout .wgl-thumb:empty { display: none; }
  /* גובה לפי התמונה: תמונות ישנות וקטנות נשארות חדות ובלי ריבוע ריק מסביבן */
  html body.wg-game-layout .wgl-thumb .sg-info-thumb { width: 220px; height: auto; background: transparent; }
  html body.wg-game-layout .wgl-side > .otv-ad-slot { display: block; width: 300px; min-height: 600px; margin: 0 auto; content-visibility: visible; }
  html body.wg-game-layout .wgl-rec { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 10px; }
  html body.wg-game-layout .wgl-rec[hidden] { display: none; }
  html body.wg-game-layout .wgl-rec-title { font-size: 1.05rem; font-weight: 700; text-align: center; margin-bottom: 10px; }
  html body.wg-game-layout .wgl-rec-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 8px; }
  html body.wg-game-layout .wgl-rec-grid a { display: block; min-width: 0; text-decoration: none; }
  html body.wg-game-layout .wgl-rec-grid img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; background: var(--accent-light); }

  /* יחידה רספונסיבית בתוך flex מקבלת רוחב 0, ולכן כאן block */
  html body.wg-game-layout #ad-game_bottom { display: block; width: 100%; max-width: 1200px; margin: 24px auto 0; }
}

@media (min-width: 1100px) and (max-width: 1699px) {
  html body.wg-game-layout .sg-game-bar .sg-rate-label { display: none; }
}

@media (min-width: 1280px) {
  html body.wg-game-layout .wgl-main .sg-similar-grid { grid-template-columns: repeat(8, minmax(0, 1fr)) !important; }
}

/* מרוחב 1515 שתי העמודות הגבוהות ברוחב 300 */
@media (min-width: 1515px) {
  html body.wg-game-layout .sg-above { grid-template-columns: minmax(0, 1fr) 300px !important; }
  html body.wg-game-layout .sg-above.wg-has-promo { grid-template-columns: 300px minmax(0, 1fr) 300px !important; }
}
