/**
 * Index feed — equal card height on all non-PC widths (≤1199.98).
 * PC ≥1200 untouched.
 *
 * Culprit: tablet-card-unlock / last-tall set align-items:start + height:auto
 * → posts, banners, contest, video jump vertically in the same row.
 *
 * Injected LAST via cotinder-feed-tablet-card-unlock.js after unlock/void.
 * Marker: feedeqh20261029b
 */

/* ========== Tablet / mid: 481–1199 (2–3 cols) ========== */
@media (min-width: 481px) and (max-width: 1199.98px) {
  /* Beat void/unlock align-items:start (same or higher specificity, loads last) */
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts,
  html body .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts,
  html body .tabs__content.tabs__content_active .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts,
  html body.page-index .tabs__content.tabs__content_active .cotinder-index-feed[data-cotinder-feed-tab] .index__posts,
  html body.page-index .tabs__content.tabs__content_active .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts {
    align-items: stretch !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post:not(.index__post_full):not(.index__post_be-part):not(.cotinder-pet-horoscope-wrap):not(.cotinder-city-ads):not(.cotinder-onboarding),
  html body .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts > .index__post:not(.index__post_full):not(.index__post_be-part):not(.index__post_curator-advice),
  html body .tabs__content.tabs__content_active .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts > .index__post:not(.index__post_full):not(.index__post_be-part):not(.cotinder-pet-horoscope-wrap):not(.cotinder-city-ads):not(.cotinder-onboarding),
  html body.page-index .tabs__content.tabs__content_active .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post:not(.index__post_full):not(.index__post_be-part):not(.cotinder-pet-horoscope-wrap):not(.cotinder-city-ads):not(.cotinder-onboarding) {
    display: flex !important;
    flex-direction: column !important;
    align-self: stretch !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  /*
   * Fill the grid cell. Must beat tablet-card-unlock which uses
   * .card:not(...):not(#post)... { height:auto; flex:0; align-self:start }.
   * :not(#post) adds ID-level specificity — mirror it here.
   */
  html body .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts > .index__post > .card:not(.card__advice):not(.card__video):not(#post):not(.index__events_event):not(.index__events_article):not(.index__collaborations_card):not(.index__community-card),
  html body .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts > .index__post:not(.index__post_feed-banner):not(.index__post_curator-advice):not(.index__post_full) > .card.user-slide:not(#post),
  html body .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts > .index__post:not(.index__post_feed-banner):not(.index__post_curator-advice):not(.index__post_full) > .card.user-slide.card__video:not(#post),
  html body .tabs__content.tabs__content_active .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts > .index__post > .card:not(.card__advice):not(.card__video):not(#post):not(.index__events_event):not(.index__events_article):not(.index__collaborations_card):not(.index__community-card),
  html body .tabs__content.tabs__content_active .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts > .index__post:not(.index__post_feed-banner):not(.index__post_curator-advice):not(.index__post_full) > .card.user-slide:not(#post),
  html body .tabs__content.tabs__content_active .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts > .index__post:not(.index__post_feed-banner):not(.index__post_curator-advice):not(.index__post_full) > .card.user-slide.card__video:not(#post),
  html body .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts > .index__post.cotinder-feed-contest > .card.arena-card:not(#post),
  html body .tabs__content.tabs__content_active .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts > .index__post.cotinder-feed-contest > .card.arena-card:not(#post),
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post.cotinder-feed-contest > .card.arena-card:not(#post),
  html body .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts > .index__post.index__post_curator-advice > .card.card__advice:not(#post),
  html body .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts > .index__post.index__post_feed-banner:not(.index__post_full) > a.card.card__cotinder:not(.card__cotinder_full):not(#post),
  html body .tabs__content.tabs__content_active .cotinder-index-feed[data-cotinder-feed-tab="last"] .index__posts > .index__post.index__post_feed-banner:not(.index__post_full) > a.card.card__cotinder:not(.card__cotinder_full):not(#post),
  html body .cotinder-index-feed[data-cotinder-feed-tab="canals"] .index__posts > .index__post > .card:not(.card__advice):not(#post),
  html body .cotinder-index-feed[data-cotinder-feed-tab="comunity"] .index__posts > .index__post > .card:not(.card__advice):not(#post),
  html body .cotinder-index-feed[data-cotinder-feed-tab="nko"] .index__posts > .index__post > .card:not(.card__advice):not(#post) {
    flex: 1 1 auto !important;
    align-self: stretch !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: none !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  /* Same media box for photo + video → rows stop jumping */
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide:not(.cotinder-lucky-wheel) > .card__media-wrap,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide:not(.cotinder-lucky-wheel) > .card-img-wrap,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide:not(.cotinder-lucky-wheel) > a.card-img-wrap,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide.card__video > .card__media-wrap {
    display: block !important;
    position: relative !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 0 10px !important;
    aspect-ratio: 3 / 4 !important;
    overflow: hidden !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide:not(.card__video) img.card-img,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide.card__video video,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide.card__video .bg-video {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center !important;
  }

  /* Fixed text block so short/long captions don't change card height */
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide:not(.index__community-card) > .card-desc {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 3 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 17px !important;
    min-height: calc(17px * 3) !important;
    max-height: calc(17px * 3) !important;
    flex: 0 0 auto !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide > .card-stars__wrapper,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide > .card-likes,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide > .card__buttons {
    flex: 0 0 auto !important;
  }

  /* Push gift/views to bottom of equal-height card */
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide > .cotinder-feed-gift {
    flex: 0 0 auto !important;
    margin-top: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* Banner fills stretched cell */
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post.index__post_feed-banner:not(.index__post_full) {
    position: relative !important;
    align-self: stretch !important;
    min-height: 0 !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post.index__post_feed-banner:not(.index__post_full) > a.card.card__cotinder:not(.card__cotinder_full) > img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
  }

  /* Contest fills same row height */
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post.cotinder-feed-contest {
    align-self: stretch !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .cotinder-feed-contest .arena-card__preview {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
    max-height: none !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .cotinder-feed-contest .arena-card__cover {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .cotinder-feed-contest .arena-card__actions {
    margin-top: auto !important;
  }

  /* Advice stretches with neighbors */
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post.index__post_curator-advice {
    align-self: stretch !important;
  }
}

/* ========== Phone ≤480: one column, same card recipe ========== */
@media (max-width: 480px) {
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post:not(.index__post_full):not(.index__post_be-part):not(.cotinder-pet-horoscope-wrap):not(.cotinder-city-ads):not(.cotinder-onboarding) {
    display: flex !important;
    flex-direction: column !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post:not(.index__post_feed-banner):not(.index__post_full) > .card.user-slide,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post:not(.index__post_feed-banner):not(.index__post_full) > .card.user-slide.card__video,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post.cotinder-feed-contest > .card.arena-card {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide:not(.cotinder-lucky-wheel) > .card__media-wrap,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide:not(.cotinder-lucky-wheel) > .card-img-wrap,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide:not(.cotinder-lucky-wheel) > a.card-img-wrap,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide.card__video > .card__media-wrap {
    display: block !important;
    position: relative !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    aspect-ratio: 3 / 4 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 0 10px !important;
    overflow: hidden !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide:not(.card__video) img.card-img,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide.card__video video,
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide.card__video .bg-video {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post > .card.user-slide:not(.index__community-card) > .card-desc {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 3 !important;
    overflow: hidden !important;
    line-height: 17px !important;
    min-height: calc(17px * 3) !important;
    max-height: calc(17px * 3) !important;
    flex: 0 0 auto !important;
  }

  /* Contest on phone: same 3:4 media block as posts */
  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .cotinder-feed-contest .arena-card__preview {
    flex: 0 0 auto !important;
    aspect-ratio: 3 / 4 !important;
    height: auto !important;
    min-height: 0 !important;
    position: relative !important;
    overflow: hidden !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .cotinder-feed-contest .arena-card__cover {
    position: absolute !important;
    inset: 0 !important;
    object-fit: cover !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post.index__post_feed-banner:not(.index__post_full) > a.card.card__cotinder:not(.card__cotinder_full) {
    display: block !important;
    width: 100% !important;
    aspect-ratio: 3 / 4 !important;
    overflow: hidden !important;
  }

  html body .cotinder-index-feed[data-cotinder-feed-tab] .index__posts > .index__post.index__post_feed-banner:not(.index__post_full) > a.card.card__cotinder:not(.card__cotinder_full) > img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }
}
