:is(#detail-dialog:has(.saved-drawer), .favorites-page) {
  --favorites-height: max(80dvh, min(660px, calc(100dvh - 24px)));
}
#detail-dialog:has(.saved-drawer) {
  position: fixed;
  inset: 0 0 0 auto;
  margin: auto clamp(0px, 4vw, 48px) auto 0;
  width: min(410px, calc(100vw - 24px));
  height: var(--favorites-height);
  max-height: none;
  padding: 0;
  border: 1px solid #cfc8b8;
  border-radius: 24px;
  background: #fcf9f0;
  overflow: hidden;
}
#detail-dialog:has(.saved-drawer) .dialog-close {
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  color: #234538;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.favorites-page { display: grid; justify-items: center; }
.saved-drawer {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  background: #fcf9f0;
  color: #192b23;
}
.favorites-page .saved-drawer {
  width: min(100%, 410px);
  height: var(--favorites-height);
  position: relative;
  border: 1px solid #cfc8b8;
  border-radius: 24px;
  overflow: hidden;
}
.favorites-header { padding: 23px 66px 14px 23px; }
.favorites-header :is(h1,h2) { margin: 0; font-size: 1.8rem; line-height: 1.2; }
.favorites-page-close { position: absolute; top: 16px; right: 16px; width: 42px; height: 42px; border: 0; background: none; color: #234538; }
.favorites-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 5px;
  margin: 0 22px 14px;
  border-radius: 99px;
  background: #ebe5d7;
}
.favorites-tabs button { border: 0; border-radius: 99px; background: transparent; color: #514f46; min-height: 38px; padding: 5px; font-weight: 700; }
.favorites-tabs button[aria-pressed="true"] { background: #224838; color: #fffdf5; }
.favorites-body {
  padding: 0 22px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.favorite-list { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.favorite-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px 22px;
  align-items: center;
  border: 1px solid #cfc8b8;
  border-radius: 13px;
}
.favorite-pet { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 0 6px 6px; border: 0; background: transparent; color: inherit; text-align: start; }
.favorite-pet::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 22px; }
.favorite-photo { flex: 0 0 56px; height: 56px; display: grid; place-items: center; border-radius: 9px; overflow: hidden; background: #eae2d5; }
.favorite-photo :is(.pet-portrait, .gov-photo, img, video) { width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.favorite-photo .gov-no-photo { min-height: 0; font-size: .625rem; }
.favorite-photo .portrait-caption { display: none; }
.favorite-pet-copy { min-width: 0; }
.favorite-pet-copy strong { display: block; font-size: 1.125rem; line-height: 1.2; overflow-wrap: anywhere; }
.favorite-pet-copy small { display: block; font-size: .875rem; line-height: 1.35; color: #51483a; margin-top: 3px; overflow-wrap: anywhere; }
.favorite-heart { display: grid; place-items: center; width: 42px; height: 42px; color: #a9532c; background: transparent; border: 0; border-radius: 50%; }
.favorite-heart .ico { fill: currentColor; width: 23px; height: 23px; }
.favorite-chevron { pointer-events: none; color: #625743; }
.favorites-footer { display: grid; gap: 8px; padding: 13px 22px; border-top: 1px solid #d9d1c4; }
.favorite-compare-button, .favorite-support-button { justify-content: center; border: 0; border-radius: 99px; color: #fffdf5; padding-inline: 14px; }
.favorite-compare-button { background: #a9532c; }
.favorite-support-button { background: #224838; }
.favorite-prepare-button { justify-content: center; min-height: 40px; color: #224838; }
.favorite-empty { padding: 25px 13px; margin-top: 16px; text-align: center; border: 1px dashed #b8ab95; border-radius: 17px; background: #f5ecdb; }
.favorite-empty h3 { margin: 12px 0 6px; font-size: 1.25rem; }
.favorite-empty p { margin: 0 0 16px; line-height: 1.6; }
.favorite-mascot { width: 106px; margin: auto; }
.favorite-mascot svg { width: 100%; height: auto; }
.favorites-support-note { margin: 14px 0 0; padding: 12px 14px; border-radius: 13px; background: #f7d5a5; color: #3e2e20; }
.favorites-note, .favorites-loading { margin: 12px 0 4px; color: #5b5245; font-size: .875rem; }
.favorite-comparison h2 { margin-top: 14px; padding-right: 24px; }
.favorite-comparison-list { display: grid; gap: 12px; margin: 18px 0; }
.favorite-comparison-list article { padding: 14px; border: 1px solid var(--line); border-radius: 13px; }
.favorite-comparison-list h3, .favorite-comparison-list p { margin: 0 0 6px; }
@media (max-width: 520px) {
  #detail-dialog:has(.saved-drawer) { margin: auto; }
  .favorites-tabs { margin-inline: 14px; }
  .favorites-body, .favorites-footer { padding-inline: 14px; }
}
