body :is(#main, #dialog) img:is(.discover-cover, .search-profile-photo, .discover-detail-photo, .tonmio-photo-image, .tonmio-upload-pending),
body :is(.avatar, .backstage-hub-avatar, .tonmio-inbox-avatar) img {
  object-fit: cover;
  object-position: 50% 35%;
}

.tonmio-photo-frame {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel-2);
  border-radius: var(--radius-photo, 12px);
}

body #main .discover-slide-content > .tonmio-photo-frame {
  border-radius: 0;
}

body :is(#main, #dialog) .tonmio-photo-frame > .tonmio-photo-image {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  max-height: none;
  background: transparent;
  border-radius: inherit;
}

body #dialog .tonmio-photo-frame {
  height: clamp(170px, 39dvh, 380px);
  margin-block: 12px;
}

.tonmio-photo-frame:has(.tonmio-upload-preview) {
  width: min(100%, 220px);
  aspect-ratio: 1;
  margin-block: 8px;
}

.tonmio-photo-blur {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(20px) brightness(.65);
  transform: scale(1.12);
  pointer-events: none;
}

.show-whole-photo > .tonmio-photo-blur { display: block; }
body :is(#main, #dialog) .show-whole-photo > img.tonmio-photo-image {
  object-fit: contain;
  object-position: center;
}

.tonmio-photo-fit {
  position: absolute;
  z-index: 3;
  top: 8px;
  left: 8px;
  min-height: 44px;
  padding-inline: 12px;
  border: 1px solid #fff7;
  border-radius: 999px;
  color: #fff;
  background: #0e0c0ae6;
  font-size: .8125rem;
  cursor: pointer;
}

.discover-slide:has(.discover-date) .tonmio-photo-fit { top: 76px; }

body :is(#main, #dialog) .tonmio-upload-picker {
  position: relative;
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 72px;
  padding: 12px;
  border: 1px dashed var(--accent-ink);
  border-radius: var(--radius, 10px);
  color: var(--ink);
  background: var(--panel-2);
  text-align: center;
  cursor: pointer;
}

.tonmio-upload-picker small { color: var(--text-secondary); }
.tonmio-upload-picker:focus-within { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.tonmio-upload-picker:has(input:disabled) { opacity: .65; }

body :is(#main, #dialog) .tonmio-upload-picker .tonmio-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.tonmio-upload-pending {
  width: 56px;
  height: 56px;
  border-radius: 6px;
}
