
/* V2-170-R1 — deep cleanup of old offer-card experiments.
   Safe scope: mobile PWA offer list only. No renderer changes.
*/

@media (max-width: 768px) {
  /* Header: stop vertical one-letter title */
  html body .ipwa-results-head,
  html body [class*="results-head"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  html body .ipwa-results-head h1,
  html body [class*="results-head"] h1 {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 8px 0 12px !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    hyphens: none !important;
    line-height: 1.08 !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    transform: none !important;
  }

  html body .ipwa-toggle {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    width: auto !important;
    max-width: 220px !important;
    margin: 0 0 12px !important;
  }

  html body .ipwa-toggle button {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    transform: none !important;
    min-width: 64px !important;
    white-space: nowrap !important;
  }

  /* Main list: one column */
  html body .ipwa-offer-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 18px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  html body .ipwa-offer-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  /* Remove nested fake cards / duplicate cards injected by old patches.
     This is what produces the small black card next to the pink rectangle. */
  html body .ipwa-offer-card .ipwa-offer-card,
  html body .ipwa-offer-card .imz-rigid-offer-card,
  html body .ipwa-offer-card .imz-offer-card-fixed,
  html body .ipwa-offer-card .imz-single-offer-card,
  html body .ipwa-offer-card .im168-hard-card,
  html body .ipwa-offer-card .im169-card {
    display: none !important;
  }

  /* If a second visual/fallback appears after content, hide it.
     A valid card may have visual first, content second — never visual after content. */
  html body .ipwa-offer-card .ipwa-offer-content ~ .ipwa-offer-art,
  html body .ipwa-offer-card .ipwa-offer-content ~ [class*="fallback"],
  html body .ipwa-offer-card .ipwa-offer-content ~ [class*="visual"],
  html body .ipwa-offer-card .ipwa-offer-content ~ [class*="poster"],
  html body .ipwa-offer-card .ipwa-offer-content ~ [class*="photo"],
  html body .ipwa-offer-card .ipwa-offer-content ~ [class*="image"] {
    display: none !important;
  }

  /* Remove known leftovers from failed patches. */
  html body .ipwa-offer-card .imz-category-corner-icon,
  html body .ipwa-offer-card .imz-offer-visual-fallback,
  html body .ipwa-offer-card .imz-single-offer-visual,
  html body .ipwa-offer-card .imz-offer-visual-fixed,
  html body .ipwa-offer-card .im168-source-hidden,
  html body .ipwa-offer-card .im169-source-hidden,
  html body .ipwa-offer-card .im168-hard-visual,
  html body .ipwa-offer-card .im169-visual {
    display: none !important;
  }

  /* Keep native card compact and stable. */
  html body .ipwa-offer-art {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    aspect-ratio: 16 / 9 !important;
    max-height: 230px !important;
    overflow: hidden !important;
    background-size: cover !important;
    background-position: center !important;
  }

  html body .ipwa-offer-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  html body .ipwa-offer-content h1,
  html body .ipwa-offer-content h2,
  html body .ipwa-offer-content h3 {
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    hyphens: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* In list view, do not show long descriptions. Details page is for details. */
  html body .ipwa-offer-list .ipwa-offer-content p:not(.ipwa-card-meta):not(.ipwa-badge-row) {
    display: none !important;
  }

  /* Limit noisy badges/meta; keep only core rows. */
  html body .ipwa-badge-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
    max-height: 30px !important;
  }

  html body .ipwa-badge-row .ipwa-badge:nth-child(n+4),
  html body .ipwa-card-meta span:nth-child(n+4) {
    display: none !important;
  }

  html body .ipwa-card-meta {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 6px !important;
    overflow: hidden !important;
  }

  html body .ipwa-card-meta span {
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  html body .ipwa-offer-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  html body .ipwa-offer-actions button,
  html body .ipwa-offer-actions a {
    width: 100% !important;
    min-width: 0 !important;
    white-space: normal !important;
  }

  /* Navigation safety */
  html body .ipwa-bottom-nav,
  html body .ipwa-bottom-nav *,
  html body nav,
  html body nav *,
  html body footer,
  html body footer * {
    pointer-events: auto !important;
    touch-action: manipulation !important;
  }
}
