/* Default encounter views preserve the landscape composition. */
.encounter-art img,
.library-thumbnail-art img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}
.card-library .library-encounter-preview {
  grid-template-columns: minmax(0, 1fr);
  padding: 0 0 12px;
  overflow: hidden;
}
.library-thumbnail-copy { padding-inline: 12px; }
.library-encounter-detail .encounter-art img { max-height: none; }
.playing .game-details .encounter-art { display: block; }
.playing .game-details .encounter-art img { max-height: none; }
.playing .active-obstacle .encounter.compact-encounter {
  justify-content: flex-start;
  overflow-y: auto;
  width: min(100%, 1280px);
  padding: 4px 12px;
  gap: 4px;
}
.playing .compact-encounter .encounter-art {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  height: clamp(40px, 6dvh, 64px);
  align-self: stretch;
  margin: 0;
  overflow: hidden;
}
.playing .compact-encounter .encounter-art img {
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  object-fit: cover;
  object-position: center 40%;
}
.playing .compact-encounter .encounter-details-button {
  top: 6px;
  right: 14px;
  z-index: 1;
  min-height: 32px;
  width: 32px;
  padding: 0;
  background: #102b28e6;
  color: #fff0c7;
}
.playing .compact-encounter .encounter-copy {
  flex: 0 0 auto;
  overflow: visible;
}
.playing .compact-encounter .chosen-outcome { margin: 0; padding-top: 2px; }
@media (min-width: 761px) {
  .playing .compact-encounter .encounter-copy {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 3px 24px;
    align-items: start;
    text-align: left;
  }
  .playing .compact-encounter .encounter-copy h3 {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    font-size: clamp(22px, 2.2vw, 28px);
    line-height: 1.15;
  }
  .playing .compact-encounter .encounter-treatments {
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-start;
    margin: 0;
  }
  .playing .compact-encounter .encounter-copy > p {
    grid-column: 1;
    margin: 0;
    font-size: 14px;
    line-height: 1.35;
  }
  .playing .compact-encounter .approach-outcomes,
  .playing .compact-encounter .encounter-reward {
    grid-column: 2;
    grid-row: 2 / span 4;
    margin: 0;
    padding: 0;
  }
  .playing .compact-encounter .approach-outcomes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
  }
  .playing .compact-encounter .approach-outcomes p {
    font-size: 13px;
    line-height: 1.35;
  }
}

/* Switch based on the encounter's actual available width, including in boss layouts. */
.playing .active-obstacle { container: encounter-space / inline-size; }
@container encounter-space (min-width: 740px) {
  .playing .active-obstacle .encounter.compact-encounter {
    display: grid;
    grid-template-columns: clamp(180px, 25cqw, 260px) minmax(0, 1fr);
    grid-template-rows: auto;
    align-content: start;
    align-items: start;
    gap: 4px 20px;
    text-align: left;
  }
  .playing .active-obstacle .compact-encounter .encounter-copy {
    display: block;
    grid-column: 2;
    grid-row: 1;
  }
  .playing .active-obstacle .compact-encounter .encounter-copy h3 {
    padding-right: 100px;
    margin: 0 0 4px;
    font-size: clamp(22px, 2.2vw, 28px);
    line-height: 1.15;
  }
  .playing .active-obstacle .compact-encounter .encounter-art {
    grid-column: 1;
    grid-row: 1 / span 2;
    height: auto;
    width: 100%;
    align-self: start;
  }
  .playing .active-obstacle .compact-encounter .encounter-art img {
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: contain;
  }
  .playing .active-obstacle .compact-encounter .encounter-copy > p,
  .playing .active-obstacle .compact-encounter .encounter-treatments,
  .playing .active-obstacle .compact-encounter .approach-outcomes,
  .playing .active-obstacle .compact-encounter .encounter-reward,
  .playing .active-obstacle .compact-encounter .chosen-outcome {
    grid-column: 2;
    grid-row: auto;
    margin: 0;
    padding: 0;
  }
  .playing .active-obstacle .compact-encounter .encounter-treatments {
    justify-content: flex-start;
  }
  .playing .active-obstacle .compact-encounter .approach-outcomes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Tall desktop encounter spaces can carry larger art without adding a grid row. */
@media (min-height: 800px) {
  @container encounter-space (min-width: 1100px) {
    .playing .active-obstacle .encounter.compact-encounter {
      grid-template-columns: minmax(300px, 38%) minmax(0, 1fr);
    }
    .playing .active-obstacle .compact-encounter .encounter-art {
      position: absolute;
      grid-area: auto;
      inset: 0 auto 0 0;
      width: 44%;
      height: 100%;
      pointer-events: none;
      -webkit-mask-image: linear-gradient(to right, #000 55%, #000c 70%, transparent 100%);
      mask-image: linear-gradient(to right, #000 55%, #000c 70%, transparent 100%);
    }
    .playing .active-obstacle .compact-encounter .encounter-art img {
      height: 100%;
      max-height: none;
      aspect-ratio: auto;
      object-fit: cover;
      object-position: center;
    }
    .playing .active-obstacle .compact-encounter .encounter-copy,
    .playing .active-obstacle .compact-encounter .chosen-outcome {
      position: relative;
      z-index: 1;
    }
  }
}

/* Homepage reveal artwork fills the top of the tile. */
.encounter-tile {
  --encounter-inset: 24px;
  padding: 0 0 var(--encounter-inset);
}
.encounter-tile .tile-topline {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  padding: var(--encounter-inset) var(--encounter-inset) 36px;
  background: linear-gradient(#001109cc, transparent);
  pointer-events: none;
}
.encounter-tile .tile-topline span { color: var(--mint); }
.encounter-tile .hero-reveal {
  min-height: 0;
  justify-content: flex-start;
}
.encounter-tile .reveal-art {
  display: block;
  width: 100%;
  height: clamp(180px, 24vw, 240px);
  margin: 0;
  overflow: hidden;
}
.encounter-tile .reveal-art img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center 40%;
  filter: none;
}
.encounter-tile .reveal-copy { padding: 24px var(--encounter-inset) 4px; }
.encounter-tile .reveal-button {
  width: calc(100% - 2 * var(--encounter-inset));
  margin-inline: var(--encounter-inset);
}
.encounter-tile .tile-caption { padding-inline: var(--encounter-inset); }
@media (max-width: 1050px) {
  .encounter-tile { --encounter-inset: 18px; }
}

/* Homepage and rules examples use a full-width cropped banner. */
.practice-encounter {
  padding: 0;
  overflow: hidden;
}
.practice-encounter .encounter-art {
  width: 100%;
  height: clamp(130px, 20vw, 220px);
  overflow: hidden;
}
.practice-encounter .encounter-art img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  object-fit: cover;
  object-position: center 40%;
}
.practice-encounter .encounter-copy {
  padding: 20px;
}
@media (max-width: 760px) {
  .practice-encounter .encounter-copy { padding: 14px; }
}

/* Landing-page cards have square corners at every screen size. */
.camp-home .mosaic-tile,
.camp-home .camp-entry,
.camp-home .rooms-state,
.camp-home .public-room-list li,
.camp-home .learn-playground,
.camp-home .practice-encounter,
.camp-home .practice-card,
.camp-home .showcase-card {
  border-radius: 0;
}
