.ad-slot[hidden],
.ad-slot:not([data-ad-ready]) { display: none !important; }

.ad-slot {
  --ad-height: 180px;
  min-inline-size: 0;
  max-inline-size: 720px;
  margin-block: var(--s-4, 16px);
  margin-inline: auto;
}

.ad-slot__render {
  inline-size: 100%;
  min-block-size: var(--ad-height);
}

.ad-slot--recommendation {
  --ad-widget-reserve: 126px;
  max-inline-size: 600px;
  margin-block: 0;
}

.ad-slot--recommendation .ad-slot__render { min-block-size: 0; }

.ad-slot--recommendation[data-ad-requested] {
  min-block-size: var(--ad-widget-reserve);
  margin-block: var(--s-4, 16px);
}

.ad-slot--recommendation[data-ad-requested] .ad-slot__render { min-block-size: 50px; }

.ad-slot--recommendation .ad-slot__render > iframe {
  /* The vendor frame starts with a light canvas. Match its scheme so its transparent canvas
     can show the page surface. Card colors are set separately by the widget's darkTheme option. */
  color-scheme: light;
  background-color: var(--bg);
}

@media (max-width: 430px) {
  .ad-slot--recommendation { --ad-widget-reserve: 166px; }
}

@media (min-width: 641px) {
  :is([data-ad-feed="home_latest_recommendation"], [data-ad-feed="facet_video_recommendation"])[data-ad-widget-first-rank]
    > :is([data-ad-grid], .ad-slot--recommendation) {
    --cols: 2;
    --stagger: 0px;
    max-inline-size: 576px;
    margin-inline: auto;
  }
}

.grid + .ad-slot[hidden] + .grid,
.grid + .ad-slot--recommendation:not([data-ad-requested]) + .grid {
  margin-block-start: var(--gap, var(--s-4, 16px));
}

main:has(form[data-search-surface="home"] [aria-expanded="true"])
  [data-ad-placement="home_latest_recommendation"] {
  visibility: hidden;
  pointer-events: none;
}

html[data-ad-related-in-view] [data-player][data-stuck="1"],
html[data-ad-related-in-view] [data-dock][data-shown="1"] {
  visibility: hidden;
  pointer-events: none;
}

@media (min-width: 768px) {
  .ad-slot { --ad-height: 160px; }
}
